Shachar Shemesh wrote:

>Hi List,
>
>
>I'm having a most frustrating problem with using "XReparentWindow" to
>"take over" another application's window.
>
>
>The rest of the program is written with wxWindows. I'm getting the X11
>window ID from wx, and trying to reparent another application's window
>into mine. This is, in theory, entirly possible.
>
>
>When I actually try to run XReparentWindow, the result is a segfault. I
>tried setting an error handler (XSetErrorHandler), but it never gets called.
>  
>
Ok, this has turned out to be the second longest I spent on solving a
simple line editing bug ever.

The cause of the segfault was that I was passing NULL to the "display"
argument of XReparentWindow.

The reason I was doing this was that a structure defined inside another
class had a constructor that zeroed out the "Display" member. The
function that initialized the display member was run by the
initialization of another member of the same class, resulting in the
display argument being overwritten by the relevant constructor.

The solution - reverse the order of the member definitions.

Yes, I know, it's my fault for using C++. The problem is that the
program really should be cross platform, and so far I managed to avoid
all #ifdefs by containing the non-portable code into seperate files. The
project settings decide which file to compile into the project based on
platform. Such tricks are great for doing this, when they work.

Well, back to work. Thanks everyone for attempting to help.

             Shachar

-- 
Shachar Shemesh
Lingnu Open Source Consulting ltd.
Have you backed up today's work? http://www.lingnu.com/backup.html


=================================================================
To unsubscribe, send mail to [EMAIL PROTECTED] with
the word "unsubscribe" in the message body, e.g., run the command
echo unsubscribe | mail [EMAIL PROTECTED]

Reply via email to