do the real work in an idle (transfer_done_idle_cb): do the real work

2002-07-05  jacob berkman  <jacob@ximian.com>

	* theme-switcher.c (transfer_done_cb): do the real work in an idle
	(transfer_done_idle_cb): do the real work

	this fixes bug #86141 - i don't understand why, but some very evil
	things seem to have been happening.  see that bug for details.
This commit is contained in:
jacob berkman 2002-07-05 18:23:18 +00:00 committed by Jacob Berkman
parent 8f8dbd63fa
commit 69c4613e95
2 changed files with 37 additions and 11 deletions

View file

@ -1,3 +1,11 @@
2002-07-05 jacob berkman <jacob@ximian.com>
* theme-switcher.c (transfer_done_cb): do the real work in an idle
(transfer_done_idle_cb): do the real work
this fixes bug #86141 - i don't understand why, but some very evil
things seem to have been happening. see that bug for details.
2002-06-17 Jody Goldberg <jody@gnome.org>
* Release 2.0.0

View file

@ -331,22 +331,40 @@ transfer_cancel_cb (GtkWidget *dlg, gchar *path)
gtk_widget_destroy (dlg);
}
static void
transfer_done_cb (GtkWidget *dlg, gchar *path)
{
int len = strlen (path);
if (path && len > 7 && !strcmp (path + len - 7, ".tar.gz"))
/* this works around problems when doing fork/exec in a threaded app
* with some locks being held/waited on in different threads.
*
* we do the idle callback so that the async xfer has finished and
* cleaned up its vfs job. otherwise it seems the slave thread gets
* woken up and it removes itself from the job queue before it is
* supposed to. very strange.
*
* see bugzilla.gnome.org #86141 for details
*/
static gboolean
transfer_done_idle_cb (gpointer data)
{
int status;
gchar *command;
gchar *path = data;
/* this should be something more clever and nonblocking */
command = g_strdup_printf ("sh -c 'gzip -d -c < \"%s\" | tar xf - -C \"%s/.themes\"'",
path, g_get_home_dir ());
if (g_spawn_command_line_sync (command, NULL, NULL, &status, NULL) && status == 0)
gnome_vfs_unlink (path);
g_free (command);
}
g_free (path);
return FALSE;
}
static void
transfer_done_cb (GtkWidget *dlg, gchar *path)
{
int len = strlen (path);
if (path && len > 7 && !strcmp (path + len - 7, ".tar.gz"))
g_idle_add (transfer_done_idle_cb, path);
gtk_widget_destroy (dlg);
}