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 673664 - Evince cannot run with Broadway GDK backend. (Patch included)
Evince cannot run with Broadway GDK backend. (Patch included)
Status: RESOLVED FIXED
Product: evince
Classification: Core
Component: general
3.4.x
Other Linux
: Normal normal
: ---
Assigned To: Evince Maintainers
Evince Maintainers
Depends on:
Blocks:
 
 
Reported: 2012-04-06 19:59 UTC by Justin Willmert
Modified: 2012-04-09 06:42 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Fix the GDK backend support. (2.56 KB, patch)
2012-04-06 19:59 UTC, Justin Willmert
needs-work Details | Review
Check GDK runtime backend, now using window class checks (1.93 KB, patch)
2012-04-08 14:53 UTC, Justin Willmert
needs-work Details | Review
Check GDK runtime backend; fixed window class checks. (1.70 KB, patch)
2012-04-08 20:19 UTC, Justin Willmert
committed Details | Review

Description Justin Willmert 2012-04-06 19:59:25 UTC
Created attachment 211508 [details] [review]
Fix the GDK backend support.

Building from git (specifically commit ea85150), evince does not load when trying to use the Broadway backend.

$ GDK_BACKEND=broadway gdb evince
  ...
Program received signal SIGSEGV, Segmentation fault.
0x00007ffff6e70a81 in gdk_x11_atom_to_xatom_for_display (atom=0x82d, 
    display=0x69a010) at gdkproperty-x11.c:240
240	      g_return_val_if_fail (ATOM_TO_INDEX (atom) < virtual_atom_array->len, None);
 ...
(gdb) bt
  • #0 gdk_x11_atom_to_xatom_for_display
    at gdkproperty-x11.c line 240
  • #1 gdk_x11_atom_to_xatom_for_display
    at gdkproperty-x11.c line 221
  • #2 gdk_x11_get_server_time
    at gdkwindow-x11.c line 4905
  • #3 ev_application_open_window
    at ev-application.c line 753
  • #4 load_files
    at main.c line 180
  • #5 main
    at main.c line 322

I've attached a patch which fixes the segfault. I've never contributed a patch to a project before, so I'm not sure I'm doing this correctly. I've tried to follow the coding style I observed in the file. I'm also not too familiar with the GDK/GTK API, so I tried to find appropriate API calls, but improvements from a more knowledgeable person would be greatly appreciated.
Comment 1 Carlos Garcia Campos 2012-04-08 11:27:02 UTC
Review of attachment 211508 [details] [review]:

Patch looks good, thank you very much. Just a minor comment.

::: shell/ev-application.c
@@ +653,2 @@
 #ifdef GDK_WINDOWING_X11
+	if (GDK_IS_X11_DISPLAY(display)) {

You don't need to get the display to check whether it's a X11 display, you can use the window and check whether it's a X11 window with GDK_IS_X11_WINDOW().

@@ +754,2 @@
 #ifdef GDK_WINDOWING_X11
+	if (GDK_IS_X11_DISPLAY(display)) {

Ditto.
Comment 2 Justin Willmert 2012-04-08 14:51:04 UTC
Thanks. I just followed the "Backend-specific code" change guide I found online, but I now see that there are more options than just that one example for detecting the running backend.

I've attached an updated patch which addresses this change.
Comment 3 Justin Willmert 2012-04-08 14:53:22 UTC
Created attachment 211585 [details] [review]
Check GDK runtime backend, now using window class checks
Comment 4 Carlos Garcia Campos 2012-04-08 15:16:14 UTC
Review of attachment 211585 [details] [review]:

::: shell/ev-application.c
@@ +652,3 @@
 #ifdef GDK_WINDOWING_X11
+	if (GDK_IS_X11_WINDOW (GTK_WINDOW (ev_window))) {
+		gdk_window = gtk_widget_get_window (GTK_WIDGET (ev_window));

GDK_IS_X11_WINDOW() should be used with a GdkWindow, not a GtkWindow. This should be:

gdk_window = gtk_widget_get_window (GTK_WIDGET (ev_window));
if (GDK_IS_X11_WINDOW (gdk_window)) {
    .....

@@ +752,3 @@
 #ifdef GDK_WINDOWING_X11
+	if (GDK_IS_X11_WINDOW (GTK_WINDOW (new_window))) {
+		gdk_window = gtk_widget_get_window (GTK_WIDGET (new_window));

Ditto.
Comment 5 Justin Willmert 2012-04-08 20:19:07 UTC
Thank you for your patience. Hopefully I've got everything this time. Updated patch attached.
Comment 6 Justin Willmert 2012-04-08 20:19:58 UTC
Created attachment 211600 [details] [review]
Check GDK runtime backend; fixed window class checks.
Comment 7 Carlos Garcia Campos 2012-04-09 06:41:37 UTC
Review of attachment 211600 [details] [review]:

Perfect! Thank you very much.