[geany/geany-plugins] ce9a8f: commander: Fix crash on startup with latest GTK3

Colomban Wendling git-noreply at xxxxx
Mon Dec 5 13:06:21 UTC 2016


Branch:      refs/heads/master
Author:      Colomban Wendling <ban at herbesfolles.org>
Committer:   Colomban Wendling <ban at herbesfolles.org>
Date:        Mon, 05 Dec 2016 13:06:21 UTC
Commit:      ce9a8f967429b4a579a9929b498a62de04a8c5ef
             https://github.com/geany/geany-plugins/commit/ce9a8f967429b4a579a9929b498a62de04a8c5ef

Log Message:
-----------
commander: Fix crash on startup with latest GTK3

Latest GTK3 seems to emit notify::text when getting packed in a
container, in response to layout-changed.  Thus, we need not to connect
handlers relying on not-yet-valid pointers.  Fix that by connecting to
signals after everything is properly set up.


Modified Paths:
--------------
    commander/src/commander-plugin.c

Modified: commander/src/commander-plugin.c
10 lines changed, 6 insertions(+), 4 deletions(-)
===================================================================
@@ -682,10 +682,6 @@ create_panel (void)
   gtk_container_add (GTK_CONTAINER (frame), box);
   
   plugin_data.entry = gtk_entry_new ();
-  g_signal_connect (plugin_data.entry, "notify::text",
-                    G_CALLBACK (on_entry_text_notify), NULL);
-  g_signal_connect (plugin_data.entry, "activate",
-                    G_CALLBACK (on_entry_activate), NULL);
   gtk_box_pack_start (GTK_BOX (box), plugin_data.entry, FALSE, TRUE, 0);
   
   plugin_data.store = gtk_list_store_new (COL_COUNT,
@@ -726,6 +722,12 @@ create_panel (void)
                     G_CALLBACK (on_view_row_activated), NULL);
   gtk_container_add (GTK_CONTAINER (scroll), plugin_data.view);
   
+  /* connect entry signals after the view is created as they use it */
+  g_signal_connect (plugin_data.entry, "notify::text",
+                    G_CALLBACK (on_entry_text_notify), NULL);
+  g_signal_connect (plugin_data.entry, "activate",
+                    G_CALLBACK (on_entry_activate), NULL);
+  
   gtk_widget_show_all (frame);
 }
 



--------------
This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).


More information about the Plugins-Commits mailing list