[gnome-commander] Extract a function and move its execution below g_mutex_unlock
- From: Uwe Scholz <uwescholz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-commander] Extract a function and move its execution below g_mutex_unlock
- Date: Wed, 3 Aug 2022 20:35:25 +0000 (UTC)
commit 6d7228bd959944fbb6cca53be7ca27120e720d32
Author: Uwe Scholz <u scholz83 gmx de>
Date: Sun Jul 17 22:32:58 2022 +0200
Extract a function and move its execution below g_mutex_unlock
src/gnome-cmd-xfer.cc | 58 ++++++++++++++++++++++++++-------------------------
1 file changed, 30 insertions(+), 28 deletions(-)
---
diff --git a/src/gnome-cmd-xfer.cc b/src/gnome-cmd-xfer.cc
index 057c8224..457e9426 100644
--- a/src/gnome-cmd-xfer.cc
+++ b/src/gnome-cmd-xfer.cc
@@ -395,6 +395,29 @@ static void update_transfer_gui_error_move (XferData *xferData)
}
}
+static void finish_xfer(XferData *xferData)
+{
+ // Only update the files if needed
+ if (xferData->destGnomeCmdDir)
+ {
+ gnome_cmd_dir_relist_files (xferData->destGnomeCmdDir, FALSE);
+ main_win->focus_file_lists();
+ gnome_cmd_dir_unref (xferData->destGnomeCmdDir);
+ xferData->destGnomeCmdDir = nullptr;
+ }
+ if (xferData->win)
+ {
+ gtk_widget_destroy (GTK_WIDGET (xferData->win));
+ xferData->win = nullptr;
+ }
+ if (xferData->problem_action == COPY_ERROR_ACTION_NO_ACTION_YET
+ && xferData->on_completed_func)
+ {
+ xferData->on_completed_func (xferData->on_completed_data, nullptr);
+ }
+ free_xfer_data (xferData);
+}
+
static gboolean update_transfer_gui (XferData *xferData)
{
g_mutex_lock (&xferData->mutex);
@@ -428,34 +451,6 @@ static gboolean update_transfer_gui (XferData *xferData)
return FALSE;
}
- if (xferData->done)
- {
- // Only update the files if needed
- if (xferData->destGnomeCmdDir)
- {
- gnome_cmd_dir_relist_files (xferData->destGnomeCmdDir, FALSE);
- main_win->focus_file_lists();
- gnome_cmd_dir_unref (xferData->destGnomeCmdDir);
- xferData->destGnomeCmdDir = nullptr;
- }
-
- if (xferData->win)
- {
- gtk_widget_destroy (GTK_WIDGET (xferData->win));
- xferData->win = nullptr;
- }
-
- if (xferData->problem_action == COPY_ERROR_ACTION_NO_ACTION_YET
- && xferData->on_completed_func)
- {
- xferData->on_completed_func (xferData->on_completed_data, nullptr);
- }
-
- free_xfer_data (xferData);
-
- return FALSE;
- }
-
if (xferData->bytesTotalTransferred == 0)
gnome_cmd_xfer_progress_win_set_action (xferData->win, _("copying…"));
@@ -486,8 +481,15 @@ static gboolean update_transfer_gui (XferData *xferData)
gtk_main_iteration_do (FALSE);
}
}
+
g_mutex_unlock (&xferData->mutex);
+ if (xferData->done)
+ {
+ finish_xfer(xferData);
+ return FALSE;
+ }
+
return TRUE;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]