Re: [PATCH] If running in GNU gdb, disable grabs



On Sat, 2009-08-22 at 18:38 +0200, Martin Nordholts wrote:
> Hi,
> 
> When debugging applications that uses a lot of grabs, such as the GIMP 
> paint core, it is annoying when breakpoints are hit while in a grab. 
> There are ways to remedy this, but for an inexperience developer it 
> appears as if X11 completely freezes.
> 
> I have attached two patches to this mail. The first one adds the 
> possibility to disable grabs with the GTK_DEBUG environment variable, 
> the other patch disable grabs if we appear to run in GNU gdb. The 
> approach is inspired by the Qt toolkit which uses the same approach.
> 
> I wanted to discuss this on the mailing list before filing any bug 
> report. So, does this make sense to anyone else? I have push access so 
> when these patches have been reviewed and approved, I can push this to 
> git master.

The idea is reasonable - certainly would prevent a common
novice-gtk-programmer mistake... if the programmer doesn't know about
GDK_DEBUG=nograbs.

It is much harder to get in trouble these days with this then it used to
be since we use many less X grabs then we used to and are careful to
flush X ungrabs before activating a menu item callbacks. But there are
still a few cases where it still matters.

It's probably good to extend the message to explicitly say that things
are going to work funny (menus, comboboxes, scale buttons, etc.) and
some things (drag-and-drop, e.g.) won't work at all.

(Alternative - maybe it should just be reversed, and instead of
disabling grabs, we should just print a helpful message that you can
use GDK_DEBUG=nograbs ? but if you don't know how to switch-to-a-vt
and kill -9 gdb you might not read that message until you were already
locked up and had to reboot...)

However, I don't see how your patch does anything - *GTK* grabs aren't
an issue - they only control delivery of events that are already going
to the process anyways. You actually should be interested in *GDK*
grabs.

- Owen




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