changeset 3654:3910ad643e9d

plugin android: use `callFromThread` instead of `callLater`: `callLater` is not made to be called outside of main thread, `callFromThread` is the method to call in this case.
author Goffi <goffi@goffi.org>
date Wed, 08 Sep 2021 11:17:13 +0200
parents d2b17f0f2615
children ca980569318c
files sat/plugins/plugin_misc_android.py
diffstat 1 files changed, 5 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/sat/plugins/plugin_misc_android.py	Wed Sep 08 11:17:04 2021 +0200
+++ b/sat/plugins/plugin_misc_android.py	Wed Sep 08 11:17:13 2021 +0200
@@ -309,9 +309,11 @@
         #     "XXX has no attribute 'invoke'" error (looks like the same issue as
         #     https://github.com/kivy/pyjnius/issues/59)
         self.br = BroadcastReceiver(
-            callback=lambda *args, **kwargs: reactor.callLater(0,
-                                                              self.onConnectivityChange),
-            actions=["android.net.conn.CONNECTIVITY_CHANGE"])
+            callback=lambda *args, **kwargs: reactor.callFromThread(
+                self.onConnectivityChange
+            ),
+            actions=["android.net.conn.CONNECTIVITY_CHANGE"]
+        )
         self.br.start()
 
     @property