gtk_grab_add trouble



Dear All,

according to the GTK+ FAQ to make a window modal you call gtk_grab_add (window) and then when it's destroyed called gtk_grab_remove (widndow).

However my code was using a different method!
After showing the window I call gtk_main () (yes, for the second time) and in the destroy handler I call gtk_main_quit ().

Now this admitedly incorrect technique was working just fine (on several platforms and for a long time) but I thought I'd change it to use the FAQ's reccomended technique.

Now after I call I get a SEGV with this backtrace:

#0 0x4035601a in chunk_free (ar_ptr=0x403fef00, p=0x810a2c8) at malloc.c:3128
#1  0x40355d59 in __libc_free (mem=0x810a358) at malloc.c:3054
#2  0x401a61f1 in g_free (mem=0x810a358) at gmem.c:411
#3  0x401851a2 in gdk_window_unref (window=0x810a358) at gdkwindow.c:740
#4 0x40174e0a in gdk_event_translate (event=0x80f3080, xevent=0xbffff420) at gdkevents.c:1958
#5  0x40174eef in gdk_events_queue () at gdkevents.c:2055
#6 0x4017510a in gdk_event_dispatch (source_data=0x0, current_time=0xbffff530, user_data=0x0) at gdkevents.c:2133
#7  0x401a5055 in g_main_dispatch (dispatch_time=0xbffff530) at gmain.c:656
#8  0x401a5659 in g_main_iterate (block=1, dispatch=1) at gmain.c:877
#9  0x401a57e8 in g_main_run (loop=0x80ea570) at gmain.c:935
#10 0x400bb213 in gtk_main () at gtkmain.c:524
#11 0x0805354e in main (argc=2, argv=0xbffff65c) at gtkyahoo.c:1482
#12 0x402f2177 in __libc_start_main (main=0x8053218 <main>, argc=2, ubp_av=0xbffff65c, init=0x804f738 <_init>, fini=0x806af30 <_fini>, rtld_fini=0x4000e184 <_dl_fini>, stack_end=0xbffff64c) at ../sysdeps/generic/libc-start.c:129

So I gather I'm freeing something twice or some such nonsense.

However I would like to know what other precautions that I should be taking.

I did also notice that even though the FAQ says this is how to do modal windows, the window I've done a gtk_grab_add on can still be hidden by other windows in my application should I click on them etc. This isn't what I call modal.

TIA

Craig.





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]