Package: gtk-vector-screenshot
Version: 0.3.1-1
Severity: normal
Tags: patch

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1


After switching from a different VT back to a GNOME3 fallback session,
gnome-panel dies with

(gnome-panel:4174): Gdk-WARNING **: The program 'gnome-panel' received an X
Window System error.
This probably reflects a bug in the program.
The error was 'BadWindow (invalid Window parameter)'.
  (Details: serial 10210 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.)


I painstakingly tracked this down to the XSetTextProperty() call in
pdfscreenshot_event_filter(). The attached patch fixes the problem by
replacing XSetErrorHandler() calls with
gdk(_x11_display)_error_trap_push/pop_ignored() calls, which also ignore
asynchronous errors which arrive later (there's no reason why
XSetTextProperty() would force errors to arrive synchronously).


- -- System Information:
Debian Release: wheezy/sid
  APT prefers unstable
  APT policy: (500, 'unstable'), (500, 'stable'), (102, 'experimental')
Architecture: powerpc (ppc)

Kernel: Linux 3.0.6+
Locale: LANG=de_CH.UTF-8, LC_CTYPE=de_CH.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash

Versions of packages gtk-vector-screenshot depends on:
ii  libatk1.0-0         2.2.0-2   
ii  libc6               2.13-21   
ii  libcairo-gobject2   1.10.2-6.1
ii  libcairo2           1.10.2-6.1
ii  libfontconfig1      2.8.0-3   
ii  libfreetype6        2.4.6-2   
ii  libgdk-pixbuf2.0-0  2.24.0-1  
ii  libglib2.0-0        2.28.6-1  
ii  libgtk-3-0          3.0.12-2  
ii  libgtk2.0-0         2.24.6-2  
ii  libpango1.0-0       1.29.4-1  
ii  libx11-6            2:1.4.4-2 

gtk-vector-screenshot recommends no packages.

gtk-vector-screenshot suggests no packages.

- -- no debconf information

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)

iD8DBQFOmuQnWoGvjmrbsgARAiUcAJ9j9X4kYUAQyoSquE/ZdktXN5YSZACbBZGs
kq+UUF4VcmWYPaRbV8QNZlU=
=GJI7
-----END PGP SIGNATURE-----
diff -up -ru gtk-vector-screenshot-0.3.1.orig/gtk-vector-screenshot.c gtk-vector-screenshot-0.3.1/gtk-vector-screenshot.c
--- gtk-vector-screenshot-0.3.1.orig/gtk-vector-screenshot.c	2011-08-27 10:48:39.000000000 +0200
+++ gtk-vector-screenshot-0.3.1/gtk-vector-screenshot.c	2011-10-16 15:47:27.000000000 +0200
@@ -311,14 +311,22 @@ pdfscreenshot_event_filter (GdkXEvent *x
 
     if (ev->type == MapNotify) {
         XTextProperty supported;
+        GdkDisplay *display = gdk_x11_lookup_xdisplay(ev->xmap.display);
+
         XStringListToTextProperty(&supported_str, 1, &supported);
 
-        old_handler = XSetErrorHandler (silent_error_handler);
+        if (display)
+            gdk_x11_display_error_trap_push(display);
+        else
+            gdk_error_trap_push();
         XSetTextProperty(ev->xmap.display,
             ev->xmap.window,
             &supported,
             gdk_x11_atom_to_xatom(pdfscreenshot_atom));
-        (void) XSetErrorHandler (old_handler);
+        if (display)
+            gdk_x11_display_error_trap_pop_ignored(display);
+        else
+            gdk_error_trap_pop_ignored();
     } else if (ev->type == ClientMessage &&
             ev->xclient.message_type == gdk_x11_atom_to_xatom(pdfscreenshot_atom)) {
         if (event->any.window != NULL) {

Reply via email to