[geary] Fix a critical when composer context menu is activated.



commit 5be8e3e5e9ab42e548dd17806cb2f89fd422e6bb
Author: Michael James Gratton <mike vee net>
Date:   Sat Jun 23 16:57:41 2018 +1000

    Fix a critical when composer context menu is activated.

 src/client/composer/composer-widget.vala | 21 ++++++++++++++-------
 1 file changed, 14 insertions(+), 7 deletions(-)
---
diff --git a/src/client/composer/composer-widget.vala b/src/client/composer/composer-widget.vala
index 420cb9fa..0dddd930 100644
--- a/src/client/composer/composer-widget.vala
+++ b/src/client/composer/composer-widget.vala
@@ -1930,14 +1930,21 @@ public class ComposerWidget : Gtk.EventBox {
     private inline void append_menu_section(WebKit.ContextMenu context_menu,
                                             Menu section) {
         GtkUtil.menu_foreach(section, (label, name, target, section) => {
-                if ("." in name)
-                    name = name.split(".")[1];
+                string simple_name = name;
+                if ("." in simple_name) {
+                    simple_name = simple_name.split(".")[1];
+                }
 
-                GLib.SimpleAction action = new GLib.SimpleAction(name, null);
-                action.set_enabled(get_action(name).enabled);
-                context_menu.append(
-                    new WebKit.ContextMenuItem.from_gaction(action, label, null)
-                );
+                GLib.SimpleAction? action = get_action(simple_name);
+                if (action != null) {
+                    context_menu.append(
+                        new WebKit.ContextMenuItem.from_gaction(
+                            action, label, target
+                        )
+                    );
+                } else {
+                    warning("Unknown action: %s/%s", name, label);
+                }
             });
     }
 


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