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 638477 - [PATCH] Banshee crashes with a BadMatch X error
[PATCH] Banshee crashes with a BadMatch X error
Status: RESOLVED FIXED
Product: banshee
Classification: Other
Component: User Interface
1.8.0
Other Linux
: Normal critical
: 1.x
Assigned To: Banshee Maintainers
Banshee Maintainers
Depends on:
Blocks:
 
 
Reported: 2011-01-02 01:21 UTC by Christian Krause
Modified: 2011-01-03 18:49 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
patch to fix the issue (2.75 KB, patch)
2011-01-02 01:21 UTC, Christian Krause
needs-work Details | Review
patch to fix the issue, incoroporated suggestions from comment #1 (4.09 KB, patch)
2011-01-02 20:13 UTC, Christian Krause
none Details | Review

Description Christian Krause 2011-01-02 01:21:07 UTC
Created attachment 177336 [details] [review]
patch to fix the issue

Under the following circumstances banshee will crash with an X error:

- KDE 4
and
- x86_64
and
- "Notification Area Icon" extension enabled

How to reproduce:
- start banshee

Backtrace:

Gdk-ERROR **: The program 'Banshee' received an X Window System error.
This probably reflects a bug in the program.
The error was 'BadMatch (invalid parameter attributes)'.
  (Details: serial 3066 error_code 8 request_code 2 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.)
aborting...
Stacktrace:

  at (wrapper managed-to-native) X11NotificationArea.gdk_x11_get_server_time (intptr) <0x0005b>
  at (wrapper managed-to-native) X11NotificationArea.gdk_x11_get_server_time (intptr) <0x0005b>
  at X11NotificationArea.SendManagerMessage (X11NotificationArea/SystemTrayMessage,intptr,uint,uint,uint) <0x000af>
  at X11NotificationArea.SendDockRequest () <0x00037>
  at X11NotificationArea.OnRealized () <0x00037>

Notes:
- the issue can be prevented if banshee is started with: 
XLIB_SKIP_ARGB_VISUALS=1 banshee

- similar to https://bugzilla.gnome.org/show_bug.cgi?id=620461 

- Fedora bug report: https://bugzilla.redhat.com/show_bug.cgi?id=664636

Suggested fix:
- it looks like that the check whether the notification area is an rgba visual in src/Extensions/Banshee.NotificationArea/Banshee.NotificationArea/X11NotificationArea.cs: 
--------------------------
       // TODO the proper check is (visual->red_prec + visual->blue_prec + visual->green_prec < visual->depth)
       // but this seems to work
       visual_is_rgba = visual != null && visual == Screen.RgbaVisual;
--------------------------
is not sufficient

- on x86_64 systems running kde the visual of the tray area seems not to be identical with the visual returned via gdk_screen_get_rgba_visual (it seems that there is more than one rgba visual in the system ...)

- I have implemented the algorithm already suggested in the "todo" of the file: don't compare the native GdkVisual objects but actually check for the content of the used visual. Please see the attached patch against git master which applies to stable-1.8 as well. It is only roughly tested, but so far it looks good.

- If there will be another 1.8.x release, please fix it in stable-1.8 and master, otherwise master should be sufficient. Thank you very much!
Comment 1 Bertrand Lorentz 2011-01-02 15:54:08 UTC
Review of attachment 177336 [details] [review]:

Thanks for looking into this !
I remember some crash reports after I did this bit with the TODO, but couldn't reproduce them.

The code itself looks fine, but the gdk_visual_get_* functions have only been added in gdk 2.22. Since we support older versions, we'd need some #ifdef'ing for that.
See the doc :
http://library.gnome.org/devel/gdk/stable/gdk-Visuals.html#gdk-visual-get-depth
Comment 2 Christian Krause 2011-01-02 20:13:56 UTC
Created attachment 177374 [details] [review]
patch to fix the issue, incoroporated suggestions from comment #1

I'm not very familiar with banshee's autoconf/automake system, but I gave it a shot. The new patch includes a fallback to the old implementation when gtk2 < 2.22.
Comment 3 Bertrand Lorentz 2011-01-03 18:49:07 UTC
Thanks for the update !

I just committed the patch to git master and the stable-1.8 branch, with a few changes to the auto-foo :

- As the pkg-config check didn't really fit in any .m4 file, I put it into configure.ac directly.
- I changed the check to look for gdk-x11 >=2.22, which I believe is where the functions are.

Now I'm going to look for crash reports which might be fixed by this :)