[Xfce4-commits] r26499 - xarchiver/trunk/src

Giuseppe Torelli colossus at xfce.org
Fri Dec 21 14:31:41 CET 2007


Author: colossus
Date: 2007-12-21 13:31:41 +0000 (Fri, 21 Dec 2007)
New Revision: 26499

Modified:
   xarchiver/trunk/src/rpm.c
   xarchiver/trunk/src/window.c
Log:
Fixed seg-fault when opening rpm packages.
Fixed seg-fault when dragging an entry from Xarchiver.


Modified: xarchiver/trunk/src/rpm.c
===================================================================
--- xarchiver/trunk/src/rpm.c	2007-12-21 11:15:26 UTC (rev 26498)
+++ xarchiver/trunk/src/rpm.c	2007-12-21 13:31:41 UTC (rev 26499)
@@ -35,6 +35,7 @@
 	unsigned short int i;
     int dl,il,sigsize,offset;
     gchar *ibs;
+	GSList *list = NULL;
 
     signal (SIGPIPE, SIG_IGN);
     stream = fopen ( archive->path , "r" );
@@ -42,7 +43,7 @@
     {
         gchar *msg = g_strdup_printf (_("Can't open RPM file %s:") , archive->path);
 		response = xa_show_message_dialog (GTK_WINDOW (MainWindow) , GTK_DIALOG_MODAL,GTK_MESSAGE_ERROR,GTK_BUTTONS_OK,
-		msg,g_strerror (errno));
+		msg,g_strerror(errno));
 		g_free (msg);
 		return;
     }
@@ -106,8 +107,9 @@
 	//Now I run dd to have the bzip2 / gzip compressed cpio archive in /tmp
 	gchar *command = g_strconcat ( "dd if=" , archive->escaped_path, " ibs=" , ibs , " skip=1 of=" , gzip_tmp , NULL );
 	g_free (ibs);
-	result = xa_run_command (archive,command);
-	g_free (command);
+	list = g_slist_append(list,command);
+	result = xa_run_command (archive,list);
+
 	if (result == FALSE)
 	{	
 		fclose (stream);

Modified: xarchiver/trunk/src/window.c
===================================================================
--- xarchiver/trunk/src/window.c	2007-12-21 11:15:26 UTC (rev 26498)
+++ xarchiver/trunk/src/window.c	2007-12-21 13:31:41 UTC (rev 26499)
@@ -1294,7 +1294,7 @@
 void xa_show_cmd_line_output (GtkMenuItem *menuitem)
 {
 	widget_data *xa_cmd_line_output;
-	GSList *output;
+	GSList *output = NULL;
 	gchar *line = NULL;
 	gchar *utf8_line;
 	gsize bytes_written;
@@ -1677,7 +1677,8 @@
     GList            *row_list;
 	gint current_page;
 	gint idx;
-
+	XEntry *entry;
+	
 	//gtk_drag_source_set_icon_name (treeview1, DATADIR "/pixmaps/xarchiver.png" );
 	current_page = gtk_notebook_get_current_page(notebook);
 	idx = xa_find_archive_index (current_page);
@@ -1685,12 +1686,13 @@
     selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (archive[idx]->treeview));
 
 	row_list = gtk_tree_selection_get_selected_rows (selection, NULL);
-	if ( row_list == NULL )
+	if ( row_list == NULL)
 		return;
 
-	gtk_tree_model_get_iter (archive[idx]->model, &iter, (GtkTreePath*) (row_list->data) );
-	gtk_tree_model_get (archive[idx]->model, &iter, 0, &name, -1);
-	gchar *no_slashes = g_strrstr ( name, "/" );
+	gtk_tree_model_get_iter(archive[idx]->model,&iter,(GtkTreePath*) (row_list->data));
+	gtk_tree_model_get (GTK_TREE_MODEL (archive[idx]->liststore),&iter,archive[idx]->nc+1,&entry, -1);
+	name = xa_build_full_path_name_from_entry(entry);
+	gchar *no_slashes = g_strrstr(name,"/");
 	if (no_slashes != NULL)
 		no_slashes++;
 	gdk_property_change (context->source_window,
@@ -1798,7 +1800,7 @@
 	archive[idx]->status = XA_ARCHIVESTATUS_IDLE;
 }
 
-void on_drag_data_received (GtkWidget *widget,GdkDragContext *context, int x,int y,GtkSelectionData *data, unsigned int info, unsigned int time, gpointer user_data)
+void on_drag_data_received (GtkWidget *widget,GdkDragContext *context,int x,int y,GtkSelectionData *data, unsigned int info,unsigned int time,gpointer user_data)
 {
 	GSList *list = NULL;
 	gchar **array = NULL;
@@ -1813,26 +1815,26 @@
 	gint current_page;
 	gint idx;
 
-	current_page = gtk_notebook_get_current_page (notebook);
-	array = gtk_selection_data_get_uris ( data );
-	if (array == NULL || GTK_WIDGET_VISIBLE (viewport2) )
+	current_page = gtk_notebook_get_current_page(notebook);
+	array = gtk_selection_data_get_uris(data);
+	if (array == NULL || GTK_WIDGET_VISIBLE(viewport2))
 	{
 		response = xa_show_message_dialog (GTK_WINDOW (MainWindow),GTK_DIALOG_MODAL,GTK_MESSAGE_ERROR,GTK_BUTTONS_OK,_("Sorry, I could not perform the operation!"),"" );
-		gtk_drag_finish (context, FALSE, FALSE, time);
+		gtk_drag_finish(context,FALSE,FALSE,time);
 		return;
 	}
-	gtk_drag_finish (context, TRUE, FALSE, time);
+	gtk_drag_finish (context,TRUE,FALSE,time);
 	one_file = (array[1] == NULL);
 
 	if (one_file)
 	{
-		filename = g_filename_from_uri ( array[0] , NULL, NULL );
-		if ( filename == NULL)
+		filename = g_filename_from_uri(array[0],NULL,NULL);
+		if (filename == NULL)
 			return;
-		else if ( xa_detect_archive_type ( filename ) > 0 )
+		else if (xa_detect_archive_type(filename) > 0)
 		{
-			xa_open_archive ( NULL, filename );
-			g_strfreev ( array );
+			xa_open_archive(NULL,filename);
+			g_strfreev(array);
 			return;
 		}
     }
@@ -1847,7 +1849,7 @@
 		xa_add_page (archive[idx]);
 	}
 	else
-		idx = xa_find_archive_index ( current_page );
+		idx = xa_find_archive_index (current_page);
 
 	if (archive[idx]->type == XARCHIVETYPE_RAR && unrar)
 	{



More information about the Xfce4-commits mailing list