[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-devel
Subject:    Re: off-topic: need help with fork and Xlib error
From:       Stefan Taferner <taferner () salzburg ! co ! at>
Date:       1999-06-01 15:29:05
[Download RAW message or body]

On Tue, 01 Jun 1999, Waldo Bastian wrote:
[...]
> So the (partial) solution to this problem is to launch the QMessageBox
> form the original thread. You can get a signal when the child exits
> can't you? I guess that's the place where the QMessageBox needs to be
> launched. Something like:
> 
> if (fork())
> {
>   /* child process */
>   if (execl())
>   {
>     /* error while launching app */
>     exit(-127);
>   }
>   else
>   { /* Launching app went ok, this is never reached.
>   }
> }

Again, you are in the "child" thread here, which will fail.

The only thing you can do is to close X's filedescriptor and then open
it again. In other words do something like:

	XCloseDisplay(qt_xdisplay());
	XOpenDisplay(qt_xdisplay());
in the child.

Well, to be more specific:

Probably you are not allowed to call XCloseDisplay(), but have to close
X's filedescriptor. There is a function that returns this filedescriptor, but I
did not find it yet in a quick search.

--Stefan

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic