[geary] Fix broken composer when invoked from a mailto: link in a conversation.



commit 89c54dba7a05ba54d2cd7301c61331e74d5b8c2d
Author: Michael James Gratton <mike vee net>
Date:   Tue Feb 6 17:53:35 2018 +1100

    Fix broken composer when invoked from a mailto: link in a conversation.
    
    Bug 771504.
    
    * src/client/application/geary-controller.vala (GearyController): Invoke
      compose_mailto() from idle to avoid web process deadlock.

 src/client/application/geary-controller.vala |   27 +++++++++++++++++++------
 1 files changed, 20 insertions(+), 7 deletions(-)
---
diff --git a/src/client/application/geary-controller.vala b/src/client/application/geary-controller.vala
index 0fc0a35..bc9f7b3 100644
--- a/src/client/application/geary-controller.vala
+++ b/src/client/application/geary-controller.vala
@@ -2659,13 +2659,7 @@ public class GearyController : Geary.BaseObject {
                 );
             });
         foreach (ConversationMessage msg_view in view) {
-            msg_view.link_activated.connect((link) => {
-                    if (link.down().has_prefix(Geary.ComposedEmail.MAILTO_SCHEME)) {
-                        compose_mailto(link);
-                    } else {
-                        open_uri(link);
-                    }
-                });
+            msg_view.link_activated.connect(on_link_activated);
             msg_view.save_image.connect((url, alt_text, buf) => {
                     on_save_image_extended(view, url, alt_text, buf);
                 });
@@ -2867,6 +2861,25 @@ public class GearyController : Geary.BaseObject {
         }
     }
 
+    private void on_link_activated(string uri) {
+        if (uri.down().has_prefix(Geary.ComposedEmail.MAILTO_SCHEME)) {
+            // We need to invoke this from idle to break the call
+            // chain from the WebKit signal which originally caused
+            // this handler to be invoked, otherwise the WebKit
+            // WebProcess will deadlock, and the resulting composer
+            // will be useless. See Geary Bug 771504
+            // <https://bugzilla.gnome.org/show_bug.cgi?id=771504>
+            // and WebKitGTK Bug 182528
+            // <https://bugs.webkit.org/show_bug.cgi?id=182528>
+            Idle.add(() => {
+                    compose_mailto(uri);
+                    return Source.REMOVE;
+                });
+        } else {
+            open_uri(uri);
+        }
+    }
+
     private void on_save_image_extended(ConversationEmail view,
                                         string url,
                                         string? alt_text,


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