Axel Simon <axel.si...@in.tum.de> writes:

> On Mar 9, 2010, at 18:19, Andy Stewart wrote:
>
>> Axel Simon <axel.si...@in.tum.de> writes:
>>
>>> Is this with the current darcs version of Gtk2Hs?
>> Yes.
>> gtk2hs darcs version with GHC 6.12.1 on Ubuntu 9.10
>
> Ok, so maybe there is still a bug with respect to finalizers in the threaded 
> RTS. However, I'm not
> sure what happens when you do a  'forkProcess'. Are you following the advice 
> on
>
> http://www.haskell.org/ghc/docs/latest/html/libraries/unix-2.4.0.0/
> System-Posix-Process.html#v%3AforkProcess
>
> that tells you not to do anything but run 'executeFile' in the forked process?
Default, first time startup program, it will run `socketMain` as
GtkSocket process.

When you press `m`, it will create notebook and GtkSocket in
`socketMain`, then got NativeWindowId from GtkSocket.

Then it will use `forkProcess` create child process for run `plugMain` when you 
transform `NativeWindowId` as program argument.

`forkProcess` and `executeFile` just startup program in child process,
nothing else.

Problem, this error not always occur, sometimes failed, sometime
success.
So i guess some place got *race condition*:

It's okay if socket process have ready before plug process create
GtkPlug.
If socket process haven't ready when plug process create GtkPlug, 
GtkPlug can't found corresponding GtkSocket to plug-in (even it got
GtkSocket's NativeWindowId), then will got `BadWindow` error.

Above just my guess, i'm not sure.

Do you know how to use gdb debug this program to get hint?
I don't know how to use gdb debugging gtk2hs program.

Thanks,

  -- Andy

>
> Axel.
>
>>>
>>> Axel
>>>
>>> On Mar 9, 2010, at 12:51, Andy Stewart wrote:
>>>
>>>> Hi Axel,
>>>>
>>>> Look Embedded.hs under `demo/embedded`, default it use `initGUI` and
>>>> everything is okay, but when i changed it to
>>>> `unsafeInitGUIForThreadedRTS` with `-threaded` flags. I will got below X
>>>> error:
>>>>
>>>> ------------------------------> X error start 
>>>> <------------------------------
>>>> (Embedded:12316): Gdk-WARNING **: GdkWindow 0x5000003 unexpectedly 
>>>> destroyed
>>>> The program 'Embedded' received an X Window System error.
>>>> This probably reflects a bug in the program.
>>>> The error was 'BadWindow (invalid Window parameter)'.
>>>>   (Details: serial 180 error_code 3 request_code 18 minor_code 0)
>>>>   (Note to programmers: normally, X errors are reported asynchronously;
>>>>    that is, you will receive the error a while after causing it.
>>>>    To debug your program, run it with the --sync command line
>>>>    option to change this behavior. You can then get a meaningful
>>>>    backtrace from your debugger if you break on the gdk_x_error() 
>>>> function.)
>>>> ------------------------------> X error end   
>>>> <------------------------------
>>>>
>>>> And this error not always occur, sometimes looks running well.
>>>> So you need test *many* times if you want to recur this error.
>>>>
>>>> I guess X window changes when i `forkProcess` plugMain, but i'm not
>>>> sure.
>>>> It's make me crazy.
>>>>
>>>> Any idea?
>>>>
>>>>   -- Andy
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> --------------------------------------------------------------------
>>>> --
>>>> --------
>>>> Download Intel&#174; Parallel Studio Eval
>>>> Try the new software tools for yourself. Speed compiling, find bugs
>>>> proactively, and fine-tune applications for parallel performance.
>>>> See why Intel Parallel Studio got high marks during beta.
>>>> http://p.sf.net/sfu/intel-sw-dev
>>>> _______________________________________________
>>>> Gtk2hs-devel mailing list
>>>> Gtk2hs-devel@lists.sourceforge.net
>>>> https://lists.sourceforge.net/lists/listinfo/gtk2hs-devel

------------------------------------------------------------------------------
Download Intel&#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
Gtk2hs-devel mailing list
Gtk2hs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gtk2hs-devel

Reply via email to