After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 630195 - Use GDK error trapping straight-up
Use GDK error trapping straight-up
Status: RESOLVED FIXED
Product: mutter
Classification: Core
Component: general
unspecified
Other All
: Normal normal
: ---
Assigned To: mutter-maint
mutter-maint
Depends on:
Blocks:
 
 
Reported: 2010-09-20 18:50 UTC by Owen Taylor
Modified: 2010-09-20 22:41 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Use GDK error trapping straight-up (3.00 KB, patch)
2010-09-20 18:50 UTC, Owen Taylor
committed Details | Review

Description Owen Taylor 2010-09-20 18:50:43 UTC
The hacks we were playing by calling gdk_error_trap_push() and then
resetting the error handler are incompatible with the rewrite of
GDK error traps.

Since the new error code has some features that simplify what we
are doing (like automatically figuring out whether a XSync() is needed)
and because our custom error handler didn't have a lot of a point),
use a separate code path for GTK+ 3.0 builds that just uses the
GDK error traps straight-up without a custom error handler.
Comment 1 Owen Taylor 2010-09-20 18:50:45 UTC
Created attachment 170691 [details] [review]
Use GDK error trapping straight-up
Comment 2 Dan Winship 2010-09-20 21:05:35 UTC
Comment on attachment 170691 [details] [review]
Use GDK error trapping straight-up

>are doing (like automatically figuring out whether a XSync() is needed)
>and because our custom error handler didn't have a lot of a point),

extra ")" there

>+ * Since the main point of our custom error trap was to get the error logged
>+ * to the right place, with GTK+-3.0 we simply omit our own error handler and
>+ * use the GTK+ handling straight-up.

I don't get it... Is there an implied "but getting the error logged to the right place isn't actually very important so we don't care"? If so, then why don't we just use gdk's error handling under 2.x too? (And also, is there any reason for using our own IOErrorHandler if we're using gdk's ErrorHandler?)


The patch otherwise seems sane, although while investigating the existing error traps to compare against gtk3, I noticed that the existing meta_error_trap_push_with_return() is obviously broken; it computes need_sync but then ignores it and just always passes FALSE to meta_error_trap_push_internal() anyway (which also means all the bookkeeping of display->error_trap_synced_at_last_pop is entirely pointless since nothing other than that code looks at it). Maybe another argument for "always use the gtk versions"...
Comment 3 Owen Taylor 2010-09-20 21:12:51 UTC
*** Bug 630207 has been marked as a duplicate of this bug. ***
Comment 4 Owen Taylor 2010-09-20 21:14:33 UTC
(In reply to comment #2)
> (From update of attachment 170691 [details] [review])
> >are doing (like automatically figuring out whether a XSync() is needed)
> >and because our custom error handler didn't have a lot of a point),
> 
> extra ")" there
> 
> >+ * Since the main point of our custom error trap was to get the error logged
> >+ * to the right place, with GTK+-3.0 we simply omit our own error handler and
> >+ * use the GTK+ handling straight-up.
> 
> I don't get it... Is there an implied "but getting the error logged to the
> right place isn't actually very important so we don't care"?

There's an implied "this is silly, let's just fix GTK+ to g_log()" and an implied "Getting the error to the right place isn't as important as getting the shell working again right now".

>  If so, then why
> don't we just use gdk's error handling under 2.x too? 

Because a) harder to make it g_log() b) I could drastically simplify the code with GTK+ 3 with performance advantages, and didn't really want to have a GTK+ 3 version, and a modified GTK+ 2 version that I wasn't going to test.

> (And also, is there any
> reason for using our own IOErrorHandler if we're using gdk's ErrorHandler?)

GDK doesn't use an IOErrorHandler, so if we want IO errors to go to the log, we need to do go it ourselves. Err, wait, GDK does have an IOError handler.

> The patch otherwise seems sane, although while investigating the existing error
> traps to compare against gtk3, I noticed that the existing
> meta_error_trap_push_with_return() is obviously broken; it computes need_sync
> but then ignores it and just always passes FALSE to
> meta_error_trap_push_internal() anyway (which also means all the bookkeeping of
> display->error_trap_synced_at_last_pop is entirely pointless since nothing
> other than that code looks at it). Maybe another argument for "always use the
> gtk versions"...

Does it sound good:

 - To move the IO Error handler along with the X error handler
 - Fix the extra )
 - File a bug/patch against GTK+ to log X[IO]Errors rather than fprintf'ing them

?
Comment 5 Dan Winship 2010-09-20 21:26:45 UTC
sure
Comment 6 Owen Taylor 2010-09-20 22:40:36 UTC
Bug 630216 filed with a GDK patch.
Comment 7 Owen Taylor 2010-09-20 22:41:46 UTC
Attachment 170691 [details] pushed as c2f8949 - Use GDK error trapping straight-up