[gnome-maps] mainWindow: Do not call grab_focus from event handler



commit 21764ac590d47067348def1231c8f3b7256a5931
Author: Jonas Danielsson <jonas threetimestwo org>
Date:   Fri Feb 27 20:22:17 2015 +0100

    mainWindow: Do not call grab_focus from event handler
    
    Since clutter switched to the Gdk backend we can not call
    anything that will generate a clutter event from a clutter
    event handler. It. Will. Deadlock.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=745248

 src/mainWindow.js |    9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)
---
diff --git a/src/mainWindow.js b/src/mainWindow.js
index 1ce9c8f..adfff1f 100644
--- a/src/mainWindow.js
+++ b/src/mainWindow.js
@@ -181,8 +181,13 @@ const MainWindow = new Lang.Class({
                             this._onConfigureEvent.bind(this));
         this.window.connect('window-state-event',
                             this._onWindowStateEvent.bind(this));
-        this.mapView.view.connect('button-press-event',
-                                  this.mapView.grab_focus.bind(this.mapView));
+        this.mapView.view.connect('button-press-event', (function() {
+            // Can not call something that will generate clutter events
+            // from a clutter event-handler. So use an idle.
+            Mainloop.idle_add((function() {
+                this.mapView.grab_focus();
+            }).bind(this));
+        }).bind(this));
 
         this.window.application.connect('notify::connected', (function() {
             if(this.window.application.connected)


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