[gimp/gimp-2-8] Bug 682585 - Edit/Modules: pressing any key crashes gimp



commit 0ed086d511729c9fca529c9ad9bd76a277de0309
Author: Michael Natterer <mitch gimp org>
Date:   Sun Oct 14 15:29:23 2012 +0200

    Bug 682585 - Edit/Modules: pressing any key crashes gimp
    
    Don't crash if module-dialog.c: dialog_select_callback() is called
    without any selected list item.
    (cherry picked from commit 20279d6fd6df8fe024f0f740e4da7cae84f85d1d)

 app/dialogs/module-dialog.c |   25 ++++++++++++++-----------
 1 files changed, 14 insertions(+), 11 deletions(-)
---
diff --git a/app/dialogs/module-dialog.c b/app/dialogs/module-dialog.c
index c4e494d..bd3af71 100644
--- a/app/dialogs/module-dialog.c
+++ b/app/dialogs/module-dialog.c
@@ -282,22 +282,25 @@ static void
 dialog_select_callback (GtkTreeSelection *sel,
                         ModuleDialog     *dialog)
 {
-  GimpModule  *module;
-  GtkTreeIter  iter;
+  GtkTreeIter iter;
 
-  gtk_tree_selection_get_selected (sel, NULL, &iter);
-  gtk_tree_model_get (GTK_TREE_MODEL (dialog->list), &iter,
-                      COLUMN_MODULE, &module, -1);
+  if (gtk_tree_selection_get_selected (sel, NULL, &iter))
+    {
+      GimpModule *module;
 
-  if (module)
-    g_object_unref (module);
+      gtk_tree_model_get (GTK_TREE_MODEL (dialog->list), &iter,
+                          COLUMN_MODULE, &module, -1);
 
-  if (dialog->selected == module)
-    return;
+      if (module)
+        g_object_unref (module);
 
-  dialog->selected = module;
+      if (dialog->selected == module)
+        return;
 
-  dialog_info_update (dialog->gimp->module_db, dialog->selected, dialog);
+      dialog->selected = module;
+
+      dialog_info_update (dialog->gimp->module_db, dialog->selected, dialog);
+    }
 }
 
 static void



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