[gnome-commander] Fixing problem with Mutex, introduced in commit 2f598dcd



commit 586bbd343a759a7bf74c819f22d0a9a5992bf8db
Author: Uwe Scholz <uwescholz src gnome org>
Date:   Mon Apr 17 12:33:35 2017 +0200

    Fixing problem with Mutex, introduced in commit 2f598dcd

 src/dialogs/gnome-cmd-delete-dialog.cc     |   18 +++++++++---------
 src/dialogs/gnome-cmd-file-props-dialog.cc |   12 ++++++------
 2 files changed, 15 insertions(+), 15 deletions(-)
---
diff --git a/src/dialogs/gnome-cmd-delete-dialog.cc b/src/dialogs/gnome-cmd-delete-dialog.cc
index 660a735..37b67fc 100644
--- a/src/dialogs/gnome-cmd-delete-dialog.cc
+++ b/src/dialogs/gnome-cmd-delete-dialog.cc
@@ -48,7 +48,7 @@ struct DeleteData
     gboolean delete_done;         // tells the main thread that the work thread is done
     gchar *msg;                   // a message descriping the current status of the delete operation
     gfloat progress;              // a float values between 0 and 1 representing the progress of the whole 
operation
-    GMutex *mutex;                // used to sync the main and worker thread
+    GMutex mutex;                 // used to sync the main and worker thread
 };
 
 
@@ -63,7 +63,7 @@ static gint delete_progress_callback (GnomeVFSXferProgressInfo *info, DeleteData
 {
     gint ret = 0;
 
-    g_mutex_lock (data->mutex);
+    g_mutex_lock (&data->mutex);
 
     if (info->status == GNOME_VFS_XFER_PROGRESS_STATUS_VFSERROR)
     {
@@ -71,10 +71,10 @@ static gint delete_progress_callback (GnomeVFSXferProgressInfo *info, DeleteData
         data->problem_file = str_uri_basename(info->source_name);
         data->problem = TRUE;
 
-        g_mutex_unlock (data->mutex);
+        g_mutex_unlock (&data->mutex);
         while (data->problem_action == -1)
             g_thread_yield ();
-        g_mutex_lock (data->mutex);
+        g_mutex_lock (&data->mutex);
         ret = data->problem_action;
         data->problem_action = -1;
         g_free (data->problem_file);
@@ -102,7 +102,7 @@ static gint delete_progress_callback (GnomeVFSXferProgressInfo *info, DeleteData
         else
             data->vfs_status = info->vfs_status;
 
-    g_mutex_unlock (data->mutex);
+    g_mutex_unlock (&data->mutex);
 
     return ret;
 }
@@ -194,7 +194,7 @@ static void perform_delete_operation (DeleteData *data)
 
 static gboolean update_delete_status_widgets (DeleteData *data)
 {
-    g_mutex_lock (data->mutex);
+    g_mutex_lock (&data->mutex);
 
     gtk_label_set_text (GTK_LABEL (data->proglabel), data->msg);
     gtk_progress_set_percentage (GTK_PROGRESS (data->progbar), data->progress);
@@ -212,7 +212,7 @@ static gboolean update_delete_status_widgets (DeleteData *data)
         data->problem = FALSE;
     }
 
-    g_mutex_unlock (data->mutex);
+    g_mutex_unlock (&data->mutex);
 
 
     if (data->delete_done)
@@ -243,7 +243,7 @@ static gboolean update_delete_status_widgets (DeleteData *data)
 
 inline void do_delete (DeleteData *data)
 {
-    g_mutex_init(data->mutex);
+    g_mutex_init(&data->mutex);
     data->delete_done = FALSE;
     data->vfs_status = GNOME_VFS_OK;
     data->problem_action = -1;
@@ -251,7 +251,7 @@ inline void do_delete (DeleteData *data)
 
     data->thread = g_thread_new (NULL, (GThreadFunc) perform_delete_operation, data);
     g_timeout_add (gnome_cmd_data.gui_update_rate, (GSourceFunc) update_delete_status_widgets, data);
-    g_mutex_clear(data->mutex);
+    g_mutex_clear(&data->mutex);
 }
 
 
diff --git a/src/dialogs/gnome-cmd-file-props-dialog.cc b/src/dialogs/gnome-cmd-file-props-dialog.cc
index 29bd6da..55bbf1b 100644
--- a/src/dialogs/gnome-cmd-file-props-dialog.cc
+++ b/src/dialogs/gnome-cmd-file-props-dialog.cc
@@ -44,7 +44,7 @@ struct GnomeCmdFilePropsDialogPrivate
     GtkWidget *dialog;
     GnomeCmdFile *f;
     GThread *thread;
-    GMutex *mutex;
+    GMutex mutex;
     gboolean count_done;
     gchar *msg;
     guint updater_proc_id;
@@ -113,10 +113,10 @@ static void calc_tree_size_r (GnomeCmdFilePropsDialogPrivate *data, GnomeVFSURI
     if (data->stop)
         g_thread_exit (NULL);
 
-    g_mutex_lock (data->mutex);
+    g_mutex_lock (&data->mutex);
     g_free (data->msg);
     data->msg = create_nice_size_str (data->size);
-    g_mutex_unlock (data->mutex);
+    g_mutex_unlock (&data->mutex);
 }
 
 
@@ -153,10 +153,10 @@ static void on_dialog_destroy (GtkDialog *dialog, GnomeCmdFilePropsDialogPrivate
 
 static gboolean update_count_status (GnomeCmdFilePropsDialogPrivate *data)
 {
-    g_mutex_lock (data->mutex);
+    g_mutex_lock (&data->mutex);
     if (data->size_label)
         gtk_label_set_text (GTK_LABEL (data->size_label), data->msg);
-    g_mutex_unlock (data->mutex);
+    g_mutex_unlock (&data->mutex);
 
     if (data->count_done)
     {
@@ -694,7 +694,7 @@ GtkWidget *gnome_cmd_file_props_dialog_create (GnomeCmdFile *f)
     data->dialog = GTK_WIDGET (dialog);
     data->f = f;
     data->uri = f->get_uri();
-    g_mutex_init(data->mutex);
+    g_mutex_init(&data->mutex);
     data->msg = NULL;
     data->notebook = notebook;
     f->ref();


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