Skip to content

Commit bb072ec

Browse files
jenshannoschwalmTurboGit
authored andcommitted
Remove protecting mutex in darktable.gui
1. There is no reason for the protecting mutex as all gui data changing happens in main thread. 2. We don't need to set darktable.gui to NULL as all pointers were set to NULL at the very start.
1 parent 2ed8cd9 commit bb072ec

3 files changed

Lines changed: 1 addition & 23 deletions

File tree

src/common/darktable.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1892,11 +1892,9 @@ int dt_init(int argc,
18921892
&& !(dbfilename_from_command && !strcmp(dbfilename_from_command, ":memory:"));
18931893

18941894
}
1895-
else
1896-
darktable.gui = NULL;
18971895

18981896
dt_splash_screen_set_progress(_("loading image formats"));
1899-
1897+
19001898
darktable.imageio = (dt_imageio_t *)calloc(1, sizeof(dt_imageio_t));
19011899
dt_imageio_init(darktable.imageio);
19021900

src/gui/gtk.c

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -205,10 +205,7 @@ static void _toggle_tooltip_visibility(dt_action_t *action)
205205
static inline void _update_focus_peaking_button()
206206
{
207207
// read focus peaking global state and update toggle button accordingly
208-
dt_pthread_mutex_lock(&darktable.gui->mutex);
209208
const gboolean state = darktable.gui->show_focus_peaking;
210-
dt_pthread_mutex_unlock(&darktable.gui->mutex);
211-
212209
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(darktable.gui->focus_peaking_button),
213210
state);
214211
}
@@ -217,17 +214,12 @@ static void _focuspeaking_switch_button_callback(GtkWidget *button,
217214
gpointer user_data)
218215
{
219216
// button method
220-
dt_pthread_mutex_lock(&darktable.gui->mutex);
221217
const gboolean state_memory = darktable.gui->show_focus_peaking;
222-
dt_pthread_mutex_unlock(&darktable.gui->mutex);
223-
224218
const gboolean state_new = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(button));
225219

226220
if(state_memory == state_new) return; // nothing to change, bypass
227221

228-
dt_pthread_mutex_lock(&darktable.gui->mutex);
229222
darktable.gui->show_focus_peaking = state_new;
230-
dt_pthread_mutex_unlock(&darktable.gui->mutex);
231223

232224
gtk_widget_queue_draw(button);
233225

@@ -810,8 +802,6 @@ gboolean _valid_window_placement(const gint saved_x,
810802

811803
int dt_gui_gtk_load_config()
812804
{
813-
dt_pthread_mutex_lock(&darktable.gui->mutex);
814-
815805
GtkWidget *widget = dt_ui_main_window(darktable.gui->ui);
816806
const int width = dt_conf_get_int("ui_last/window_w");
817807
const int height = dt_conf_get_int("ui_last/window_h");
@@ -842,15 +832,11 @@ int dt_gui_gtk_load_config()
842832
else
843833
darktable.gui->show_focus_peaking = FALSE;
844834

845-
dt_pthread_mutex_unlock(&darktable.gui->mutex);
846-
847835
return 0;
848836
}
849837

850838
int dt_gui_gtk_write_config()
851839
{
852-
dt_pthread_mutex_lock(&darktable.gui->mutex);
853-
854840
GtkWidget *widget = dt_ui_main_window(darktable.gui->ui);
855841
gint x, y, width, height;
856842
// Use gtk_window_get_size() instead of gtk_widget_get_allocation() to get
@@ -871,8 +857,6 @@ int dt_gui_gtk_write_config()
871857
& GDK_WINDOW_STATE_FULLSCREEN));
872858
dt_conf_set_bool("ui/show_focus_peaking", darktable.gui->show_focus_peaking);
873859

874-
dt_pthread_mutex_unlock(&darktable.gui->mutex);
875-
876860
return 0;
877861
}
878862

@@ -1318,8 +1302,6 @@ int dt_gui_theme_init(dt_gui_gtk_t *gui)
13181302

13191303
int dt_gui_gtk_init(dt_gui_gtk_t *gui)
13201304
{
1321-
dt_pthread_mutex_init(&gui->mutex, NULL);
1322-
13231305
// force gtk3 to use normal scroll bars instead of the popup
13241306
// thing. they get in the way of controls the alternative would be
13251307
// to gtk_scrolled_window_set_overlay_scrolling(..., FALSE); every

src/gui/gtk.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -146,8 +146,6 @@ typedef struct dt_gui_gtk_t
146146
guint sidebar_scroll_mask;
147147

148148
cairo_filter_t filter_image; // filtering used to scale images to screen
149-
150-
dt_pthread_mutex_t mutex;
151149
} dt_gui_gtk_t;
152150

153151
typedef struct _gui_collapsible_section_t

0 commit comments

Comments
 (0)