Thread-Safety Problem, evince versions 0.8.x

randd randd at cslimits.net
Wed Nov 7 20:53:46 PST 2007


I noted some screwy problems with evince 0.8.3: odd behavior from the print 
dialog was the one that really tipped me off to the fact that there was a 
large problem.  Note that evince is still using the gtk print system; it 
doesn't yet seem to want to work correctly with the newer GNOME print 
system, which is built on top of GTK+'s. 

The root cause of the problem as best as I could determine was a failure on 
the part of the program to inform GTK and Gdk that it (evince) was 
multi-threaded.  The fix (patch attached) is trivial: 

 ---------- cut & paste text below (but not including) this line ---------- 

 --- evince-0.8.3.ORIGINAL/shell/ev-window.c     2007-07-04 
10:55:39.000000000 -0400
+++ evince-0.8.3.FINAL/shell/ev-window.c        2007-11-07 
13:42:46.000000000 -0500
@@ -2046,6 +2046,12 @@ 

       if (error) {
               GtkWidget *dialog;
+
+      /*
+         LJM 07-11-2007
+         make GTK+, GDK aware of our theadedness
+       */
+      GDK_THREADS_ENTER(); 

               dialog = gtk_message_dialog_new (GTK_WINDOW (window),
                                                GTK_DIALOG_MODAL,
@@ -2057,6 +2063,12 @@ 

               gtk_dialog_run (GTK_DIALOG (dialog));
               gtk_widget_destroy (dialog);
+
+      /*
+         LJM
+         Corresponds with the GDK_THREADS_ENTER() above
+       */
+      GDK_THREADS_LEAVE();
       }
} 

 ---------- cut & paste text above (but not including) this line ---------- 

Note that version 0.8.0 had the same problem. 

Since applying this patch && rebuilding evince I haven't had a problem with 
it. 

 - Larry



More information about the blfs-support mailing list