[chrome-gnome-shell] Fixed a hang in native host app.



commit 25154760827e2e88607cd9cd7c9b6be0adb0f2a8
Author: Yuri Konotopov <ykonotopov gmail com>
Date:   Sun Jul 31 00:15:58 2016 +0300

    Fixed a hang in native host app.
    
    It was possible that Glib main loop was not started when main app loop
    was ready.

 connector/gs-chrome-connector.py |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)
---
diff --git a/connector/gs-chrome-connector.py b/connector/gs-chrome-connector.py
index a6efd14..73333d2 100755
--- a/connector/gs-chrome-connector.py
+++ b/connector/gs-chrome-connector.py
@@ -18,6 +18,7 @@ import os
 import re
 import struct
 import sys
+import time
 from select import select
 from threading import Thread, Lock
 
@@ -31,6 +32,7 @@ EXTENSION_DISABLE_VERSION_CHECK_KEY = "disable-extension-version-validation"
 BUFFER_SUPPORTED = hasattr(sys.stdin, 'buffer')
 mutex = Lock()
 watcherConnected = False
+mainLoopInterrupted = False
 
 # https://wiki.gnome.org/Projects/GnomeShell/Extensions/UUIDGuidelines
 def isUUID(uuid):
@@ -89,6 +91,9 @@ def dbus_call_response(method, parameters, resultProperty):
 def read_thread_func(proxy, mainLoop):
     settings = Gio.Settings.new(SHELL_SCHEMA)
 
+    while not mainLoop.is_running() and not mainLoopInterrupted:
+        time.sleep(0.2)
+
     while mainLoop.is_running():
         rlist, _, _ = select([sys.stdin], [], [], 1)
         if rlist:
@@ -242,6 +247,8 @@ if __name__ == '__main__':
     except KeyboardInterrupt:
         mainLoop.quit()
 
+    mainLoopInterrupted = True
+
     proxy.disconnect(shellSignalId)
     Gio.bus_unwatch_name(shellAppearedId)
 


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