diff --git a/src/common/styles.c b/src/common/styles.c index 6a631d1434c7..8f3bcfe377ff 100644 --- a/src/common/styles.c +++ b/src/common/styles.c @@ -937,7 +937,6 @@ void dt_styles_apply_to_image(const char *name, const gboolean duplicate, const /* remove old obsolete thumbnails */ dt_mipmap_cache_remove(darktable.mipmap_cache, newimgid); - dt_image_update_final_size(newimgid); /* update the aspect ratio. recompute only if really needed for performance reasons */ if(darktable.collection->params.sort == DT_COLLECTION_SORT_ASPECT_RATIO) diff --git a/src/develop/develop.c b/src/develop/develop.c index c50c0e7589ac..d83190ae9049 100644 --- a/src/develop/develop.c +++ b/src/develop/develop.c @@ -451,6 +451,7 @@ void dt_dev_process_preview_job(dt_develop_t *dev) if(buffer) dt_free_align(buffer); pipe->running = 0; + dt_print(DT_DEBUG_DEV, "[pixelpipe] exiting preview pipe thread\n"); } @@ -578,6 +579,7 @@ void dt_dev_process_image_job(dt_develop_t *dev) if(buffer) dt_free_align(buffer); pipe->running = 0; + dt_print(DT_DEBUG_DEV, "[pixelpipe] exiting main image pipe thread\n"); } @@ -616,11 +618,6 @@ static inline int _dt_dev_load_raw(dt_develop_t *dev, const uint32_t imgid) return (no_valid_image || no_valid_thumb); } -void dt_dev_reload_image(dt_develop_t *dev, const uint32_t imgid) -{ - dt_dev_load_image(dev, imgid); -} - float dt_dev_get_zoom_scale(dt_develop_t *dev, dt_dev_zoom_t zoom, int closeup_factor, int preview) { float zoom_scale; @@ -654,16 +651,12 @@ float dt_dev_get_zoom_scale(dt_develop_t *dev, dt_dev_zoom_t zoom, int closeup_f int dt_dev_load_image(dt_develop_t *dev, const uint32_t imgid) { - dt_pthread_mutex_lock(&dev->history_mutex); - - if(_dt_dev_load_raw(dev, imgid)) - { - dt_pthread_mutex_unlock(&dev->history_mutex); - return 1; - } + if(_dt_dev_load_raw(dev, imgid)) return 1; // we need a global lock as the dev->iop set must not be changed until read history is terminated + dt_pthread_mutex_lock(&dev->history_mutex); dev->iop = dt_iop_load_modules(dev); + dt_dev_read_history_ext(dev, dev->image_storage.id, FALSE); if(dev->pipe) diff --git a/src/develop/develop.h b/src/develop/develop.h index be6f563ac701..5655dd5dd9f6 100644 --- a/src/develop/develop.h +++ b/src/develop/develop.h @@ -346,7 +346,6 @@ void dt_dev_refresh_ui_images_real(dt_develop_t *dev); #define dt_dev_refresh_ui_images(dev) DT_DEBUG_TRACE_WRAPPER(DT_DEBUG_DEV, dt_dev_refresh_ui_images_real, (dev)) int dt_dev_load_image(dt_develop_t *dev, const uint32_t imgid); -void dt_dev_reload_image(dt_develop_t *dev, const uint32_t imgid); /** checks if provided imgid is the image currently in develop */ int dt_dev_is_current_image(dt_develop_t *dev, uint32_t imgid); diff --git a/src/iop/demosaic.c b/src/iop/demosaic.c index 29a211dff730..c533e240ac7a 100644 --- a/src/iop/demosaic.c +++ b/src/iop/demosaic.c @@ -1536,13 +1536,6 @@ void gui_changed(dt_iop_module_t *self, GtkWidget *w, void *previous) const int mask_bw = dt_image_monochrome_flags(img); changed ^= img->flags & DT_IMAGE_MONOCHROME_BAYER; dt_image_cache_write_release(darktable.image_cache, img, DT_IMAGE_CACHE_RELAXED); - if(changed) - { - dt_imageio_update_monochrome_workflow_tag(self->dev->image_storage.id, mask_bw); - // only done if one of the passthrough monochrome demosaicers has changed - // we reload the image so all modules respect this setting - dt_dev_reload_image(self->dev, self->dev->image_storage.id); - } } void gui_update(struct dt_iop_module_t *self) { diff --git a/src/views/darkroom.c b/src/views/darkroom.c index 392e967c8bc2..08ad7865e22f 100644 --- a/src/views/darkroom.c +++ b/src/views/darkroom.c @@ -828,6 +828,15 @@ static void _darkroom_ui_apply_style_activate_callback(gchar *name) { dt_control_log(_("applied style `%s' on current image"), name); + darktable.develop->exit = 1; + + // Wait for pipelines to return + dt_pthread_mutex_lock(&darktable.develop->preview_pipe->busy_mutex); + dt_pthread_mutex_unlock(&darktable.develop->preview_pipe->busy_mutex); + + dt_pthread_mutex_lock(&darktable.develop->pipe->busy_mutex); + dt_pthread_mutex_unlock(&darktable.develop->pipe->busy_mutex); + /* write current history changes so nothing gets lost */ dt_dev_write_history(darktable.develop); @@ -835,15 +844,16 @@ static void _darkroom_ui_apply_style_activate_callback(gchar *name) /* apply style on image and reload*/ dt_styles_apply_to_image(name, FALSE, FALSE, darktable.develop->image_storage.id); - dt_dev_reload_image(darktable.develop, darktable.develop->image_storage.id); - - DT_DEBUG_CONTROL_SIGNAL_RAISE(darktable.signals, DT_SIGNAL_TAG_CHANGED); /* record current history state : after change (needed for undo) */ dt_dev_undo_end_record(darktable.develop); - // rebuild the accelerators (style might have changed order) dt_iop_connect_accels_all(); + + darktable.develop->exit = 0; + + // Recompute the view + dt_dev_refresh_ui_images(darktable.develop); } static void _darkroom_ui_apply_style_popupmenu(GtkWidget *w, gpointer user_data) @@ -2348,6 +2358,13 @@ void leave(dt_view_t *self) dt_develop_t *dev = (dt_develop_t *)self->data; dev->exit = 1; + // Wait for pipelines to return + dt_pthread_mutex_lock(&dev->preview_pipe->busy_mutex); + dt_pthread_mutex_unlock(&dev->preview_pipe->busy_mutex); + + dt_pthread_mutex_lock(&dev->pipe->busy_mutex); + dt_pthread_mutex_unlock(&dev->pipe->busy_mutex); + dt_iop_color_picker_cleanup(); if(darktable.lib->proxy.colorpicker.picker_proxy) dt_iop_color_picker_reset(darktable.lib->proxy.colorpicker.picker_proxy->module, FALSE);