[shotwell] Don't update GTK+/GDK in background thread (viewer mode): Bug #736771



commit eb05bc39133ee8ebd3ce303ba2efda226dc10e44
Author: Jim Nelson <jim yorba org>
Date:   Tue Sep 16 14:08:01 2014 -0700

    Don't update GTK+/GDK in background thread (viewer mode): Bug #736771
    
    Signal being fired by DirectPhoto was bubbling up to a change in a
    GTK+ property, a problem when this occurs in a background thread.
    This change ensures the signal is fired in the main event loop.

 src/direct/DirectPhotoPage.vala |   11 +++++++++--
 1 files changed, 9 insertions(+), 2 deletions(-)
---
diff --git a/src/direct/DirectPhotoPage.vala b/src/direct/DirectPhotoPage.vala
index b2e130d..4dfd520 100644
--- a/src/direct/DirectPhotoPage.vala
+++ b/src/direct/DirectPhotoPage.vala
@@ -559,8 +559,15 @@ public class DirectPhotoPage : EditingHostPage {
     }
     
     private void on_dphoto_can_rotate_changed(bool should_allow_rotation) {
-        enable_rotate(should_allow_rotation);
-    }   
+        // since this signal handler can be called from a background thread (gah, don't get me
+        // started...), chain to the "enable-rotate" signal in the foreground thread, as it's
+        // tied to UI elements
+        Idle.add(() => {
+            enable_rotate(should_allow_rotation);
+            
+            return false;
+        });
+    }
     
     protected override DataView create_photo_view(DataSource source) {
         return new DirectView((DirectPhoto) source);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]