[libpeas] Fix critical warning when destroying a PeasPluginManagerView.



commit 7e90505b05152da4e373376f580c3331f9539510
Author: Steve FrÃcinaux <code istique net>
Date:   Wed Mar 28 12:17:19 2012 +0200

    Fix critical warning when destroying a PeasPluginManagerView.
    
    The 'cursor-changed' signal is now (since gtk+ 3.4) emitted during
    the destruction of GtkTreeView, which leads us to call
    gtk_tree_view_get_selection() after the selection object has been freed,
    hence receiving a NULL we weren't expecting before.

 libpeas-gtk/peas-gtk-plugin-manager-view.c |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)
---
diff --git a/libpeas-gtk/peas-gtk-plugin-manager-view.c b/libpeas-gtk/peas-gtk-plugin-manager-view.c
index 79b2c9a..d315af2 100644
--- a/libpeas-gtk/peas-gtk-plugin-manager-view.c
+++ b/libpeas-gtk/peas-gtk-plugin-manager-view.c
@@ -961,7 +961,11 @@ peas_gtk_plugin_manager_view_get_selected_plugin (PeasGtkPluginManagerView *view
 
   selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (view));
 
-  if (gtk_tree_selection_get_selected (selection, NULL, &iter))
+  /* Since gtk+ 3.4 gtk_tree_view_get_selection() can in practice return NULL
+   * here because 'cursor-changed' is emitted during 'destroy' (it wasn't
+   * the case previously and is not properly documented as of today).
+   */
+  if (selection != NULL && gtk_tree_selection_get_selected (selection, NULL, &iter))
     {
       convert_iter_to_child_iter (view, &iter);
       info = peas_gtk_plugin_manager_store_get_plugin (view->priv->store, &iter);



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