[comp.windows.x] destruction/freeing of XIDs

pds@quintus (Peter Schachte) (12/23/88)

In the Xlib manual, it states that once one installs a pixmap in a GC,
one may free the pixmap, and that as long as the pixmap is needed by any
object (e.g., a GC), it will not be deallocated.  Thus the question:
how far does this go?  I my process creates a pixmap and installs it as
a property of a window, and another process finds that pixmap's XID and
tries to free it, what happens?  Do I have to worry about my resources
being destroyed behind my back?
-Peter Schachte
pds@quintus.uucp
..!sun!quintus!pds

rws@EXPO.LCS.MIT.EDU (Bob Scheifler) (12/24/88)

    how far does this go?

No farther.

   If my process creates a pixmap and installs it as
   a property of a window, and another process finds that pixmap's XID and
   tries to free it, what happens?

The mapping between the id and the pixmap gets undone; if the pixmap itself
is stored in a GC or a window background, the pixmap will not get freed
until its reference count goes to zero.  The effect is no different than
if you had freed it.

   Do I have to worry about my resources
   being destroyed behind my back?

Depends on what you mean.  If you mean, should I worry about malicious
clients, the answer is no, at least not at the programming level, at
least not with the way X is defined today.