[comp.windows.x] XInternAtom

malbert@jeeves.shearson.com (Marc Albert) (04/15/91)

I have run in to what looks like an X server bug.  I create an
atom on the root window (through an application), 
delete it using xprop and confirm that it is gone (using xprop).
When I re-run the application it thinks the property is still there.

The call to XInternAtom(display, PROP_NAME, True) returns the 
value of the previous instance of the atom instead of None.

Any clues.


Sun IPC 1+
OpenWindows 2.0
OLIT
SunOS 4.1.1


Thanks,
Marc.



return address 		...uunet!shearson.com!malbert
MA Bell:		(212) 464-3061

aw@jello.bae.bellcore.com (Andrew Wason) (04/16/91)

In article <MALBERT.91Apr15111334@jeeves.shearson.com>, malbert@jeeves.shearson.com (Marc Albert) writes:
> I have run in to what looks like an X server bug.  I create an
> atom on the root window (through an application), 
> delete it using xprop and confirm that it is gone (using xprop).
> When I re-run the application it thinks the property is still there.
> 
> The call to XInternAtom(display, PROP_NAME, True) returns the 
> value of the previous instance of the atom instead of None.

'xprop -remove PROP_NAME ' deletes a window property so that
it no longer contains any data (XDeleteProperty).
The Atom which names the property continues to exist
in the server and will be returned by a call
to XInternAtom.  The only way to delete Atoms in a server
is when the server resets (all connections to it are closed).

Andrew

_______________________________________________________________________________

Andrew Wason                                       Bell Communications Research
aw@bae.bellcore.com                                Piscataway, NJ
bellcore!bae!aw

doug@genmri.UUCP (Doug Becker) (04/16/91)

    I create an
    atom on the root window (through an application), 
    delete it using xprop and confirm that it is gone (using xprop).
    When I re-run the application it thinks the property is still there.
    
    The call to XInternAtom(display, PROP_NAME, True) returns the 
    value of the previous instance of the atom instead of None.
    
I think you're confused about the difference between an atom, which is a
global server identifier, and a property, which is the value associated
with an atom on a given window.

Once an atom is created, it remains defined until the last connection to
the X server closes (see Xlib sections 4.2 [XInternAtom] and 2.6
[Connection Close Operations]).  This explains why your call to XInternAtom
succeeds.  (Note that XInternAtom doesn't take a window argument.)
XDeleteProperty deletes the property on a given window, but doesn't delete
the atom identifier that was associated with the property.

After you delete the property for the given window, intern the atom and
call XGetWindowProperty.  If XGetWindowProperty succeeds (i.e., returns
something other than None to actual_type_return, etc.) for a window upon
which the property does not exist, that's a bug, but I take it that's not
what you're seeing (you're just seeing XInternAtom returning a value other
than None, which is the correct behavior).

-- 

Doug Becker
doug@nmri.ge.com
crdgw1!sane!doug

mouse@lightning.mcrcim.mcgill.EDU (der Mouse) (04/17/91)

> I have run in to what looks like an X server bug.  I create an atom
> on the root window (through an application), delete it using xprop
> and confirm that it is gone (using xprop).

Atoms are not attached to windows.  Atoms are just names; the things
that xprop manipulate are properties.  Properties are named by atoms.
(Atoms are purely a performance optimization.  The protocol could have
been designed to pass strings back and forth instead of Atoms, but it
would have made things less efficient, and the designers apparently
felt the difference was significant.[%])  I would guess you are
creating an atom, then putting a property named by that atom on the
root, then using xprop to delete it and check that it's gone.

[%] Not that I think they're wrong; I simply do not have any data to
    tell, since I've never tried any experiments.

> When I re-run the application it thinks the property is still there.

> The call to XInternAtom(display, PROP_NAME, True) returns the value
> of the previous instance of the atom instead of None.

Well yes.  The Atom cannot be destroyed by anything short of a server
shutdown or reset.  The *property* probably is gone; use
XGetWindowProperty() to check for that from your application.

It is never reasonable to expect that any given Atom not exist.  Any
other application may have created an Atom by that name previously.
(In fact, I don't really see much point in having the third argument to
XInternAtom....)

					der Mouse

			old: mcgill-vision!mouse
			new: mouse@larry.mcrcim.mcgill.edu