[PATCH] gpe-filemanager rename crash

View: New views
2 Messages — Rating Filter:   Alert me  

[PATCH] gpe-filemanager rename crash

by Graham Gower :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Gpe-filemanager's 'Rename' File menu option causes segfaults. Rename only works
as expected from the context menu. This is due to current_popup_file not being
set until the context menu is shown.

-Graham

--- gpe-filemanager-0.31.orig/main.c
+++ gpe-filemanager-0.31/main.c
@@ -624,6 +624,9 @@
   GtkWidget *vbox, *label, *entry, *btnok;
   gchar *label_text;
 
+  if (current_popup_file == NULL)
+  return;
+
   label_text = g_strdup_printf ("%s %s %s", _("Rename file"),
                                 current_popup_file->vfs->name, _("to:"));
 
@@ -1532,42 +1535,43 @@
 static gboolean
 tree_button_press (GtkWidget *tree, GdkEventButton *b, gpointer user_data)
 {
+  gint x, y;
+  GtkTreeViewColumn *col;
+  GtkTreePath *path;
+  GtkTreeModel *store;
+  
   if (b->button == 1)
     gtk_widget_grab_focus(tree);
   
-  if ((b->button == 3) || ((b->button == 1) && (b->type == GDK_2BUTTON_PRESS)))
-    {
-      gint x, y;
-      GtkTreeViewColumn *col;
-      GtkTreePath *path;
-      GtkTreeModel *store = gtk_tree_view_get_model(GTK_TREE_VIEW(tree));
-  
-      x = b->x;
-      y = b->y;
+  x = b->x;
+  y = b->y;
+  store = gtk_tree_view_get_model(GTK_TREE_VIEW(tree));
       
-      if (gtk_tree_view_get_path_at_pos (GTK_TREE_VIEW (tree),
+  if (gtk_tree_view_get_path_at_pos (GTK_TREE_VIEW (tree),
  x, y,
  &path, &col,
  NULL, NULL))
-      {
-    GtkTreeIter iter;
-    FileInformation *i;
+    {
+      GtkTreeIter iter;
+      FileInformation *i;
 
-    gtk_tree_model_get_iter (GTK_TREE_MODEL (store), &iter, path);
+      gtk_tree_model_get_iter (GTK_TREE_MODEL (store), &iter, path);
 
-    gtk_tree_model_get (GTK_TREE_MODEL (store), &iter,
-                            tree == view_widget ? COL_DATA : COL_DIRDATA,
-                            &i, -1);
-
-    gtk_tree_path_free (path);
-        if (b->button == 3)
-          show_popup (NULL, i);
-        else
-          button_clicked (NULL, i);
-  }
-  else
-        show_popup (NULL, NULL);
-  }
+      gtk_tree_model_get (GTK_TREE_MODEL (store), &iter,
+                           tree == view_widget ? COL_DATA : COL_DIRDATA,
+                           &i, -1);
+
+      gtk_tree_path_free (path);
+
+      current_popup_file = i;
+
+      if (b->button == 3)
+         show_popup (NULL, i);
+      else if ((b->button == 1) && (b->type == GDK_2BUTTON_PRESS))
+         button_clicked (NULL, i);
+    }
+  else
+    show_popup (NULL, NULL);
 
   return FALSE;
 }

_______________________________________________
Gpe-list mailing list
Gpe-list@...
http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/gpe-list

Re: [PATCH] gpe-filemanager rename crash

by Florian Boor-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi Graham,

sorry for the long delay...

Graham Gower schrieb:
> Gpe-filemanager's 'Rename' File menu option causes segfaults. Rename
> only works
> as expected from the context menu. This is due to current_popup_file not
> being
> set until the context menu is shown.

that's good - I ran into this bug some time ago as well.
Could you send the patch attached instead of inlined? It looks like it got
damaged somehow.

Greetings

Florian

--
The dream of yesterday                  Florian Boor
is the hope of today                    Tel: +49 271-771091-15
and the reality of tomorrow.            Fax: +49 271-771091-19
[Robert Hutchings Goddard, 1904]        florian.boor@...
                                        http://www.kernelconcepts.de/en

_______________________________________________
Gpe-list mailing list
Gpe-list@...
http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/gpe-list