Re: gdk_pointer_grab bug?



Jeff Gunter <j_l_gunter@yahoo.com> writes:
> Hi all,
> 
> System miscellany: GNU/Linux, XFree86, gtk+-1.2.8 (and
> earlier, spot check finds it as far back as 1.2.1)
> 
> 
> I think there is a bug in gdk_pointer_grab(): 
> 
>   If the window argument is NULL then it returns 0;
>

Yes but only after spewing a warning, which means your program is
broken; you can't pass NULL for the window. g_return_if_fail() returns
do not produce defined behavior, they mean you should fix your
program.

In general GTK does not provide runtime recovery from programming
errors; this is different from e.g. Motif, I think. If your program is
broken then all behavior becomes undefined.
 	  
>   If the window argument is !NULL and if the grab is
> successful it returns Success which is inherited from
> X.h where it is also defined as 0;
> 
> So, checking for the return value is tricky. (The
> workaround is to make absolutely sure that you pass a
> non-NULL window, then treat a 0 return value as
> success.) 
>

It's not a workaround, just the right thing to do to begin with ;-)
 
> P.S. If there is a more appropriate place to report
> Gtk/Gdk bugs could someone point me in that general
> direction?
> 

http://bugs.gnome.org is the bug tracker.

Havoc




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