1
1
mirror of https://gitlab.gnome.org/GNOME/gimp.git synced 2025-10-06 01:12:40 +02:00

paths, tools: Prevent CRITICAL when discarding empty vector layer

Resolves #14705
The path tool prevents creating a vector layer from an empty path.
However, the menu option "Path to Vector Layers" does not have this check.
This patch updates the check to constrain it to just one path.
Additionally, it adds a check for the path being NULL before trying to use
it in g_set_object ().
This commit is contained in:
Alx Sa
2025-08-19 00:10:03 -04:00
parent baa5e0690e
commit 4b67eb9cd0
3 changed files with 8 additions and 5 deletions

View File

@@ -434,7 +434,7 @@ paths_actions_update (GimpActionGroup *group,
SET_SENSITIVE ("paths-export", n_selected_paths > 0);
SET_SENSITIVE ("paths-import", image);
SET_SENSITIVE ("paths-to-vector-layer", n_selected_paths > 0);
SET_SENSITIVE ("paths-to-vector-layer", n_selected_paths == 1);
SET_SENSITIVE ("paths-selection-to-path", image && !mask_empty);
SET_SENSITIVE ("paths-selection-to-path-advanced", image && !mask_empty);

View File

@@ -269,9 +269,12 @@ gimp_vector_layer_set_vector_options (GimpVectorLayer *layer,
layer);
g_object_unref (layer->options);
layer->options = NULL;
}
g_set_object (&layer->options, options);
if (options)
g_set_object (&layer->options, options);
gimp_vector_layer_changed_options (layer);
if (layer->options)
@@ -770,7 +773,7 @@ gimp_vector_layer_changed_options (GimpVectorLayer *layer)
{
GimpItem *item = GIMP_ITEM (layer);
if (layer->options && !layer->options->path)
if (layer->options && ! layer->options->path)
gimp_vector_layer_discard (layer);
else if (gimp_item_is_attached (item))
gimp_vector_layer_refresh (layer);

View File

@@ -740,8 +740,8 @@ gimp_path_tool_set_path (GimpPathTool *path_tool,
if (options->vector_layer_button)
{
g_signal_connect_swapped (options->vector_layer_button, "clicked",
G_CALLBACK (gimp_path_tool_create_vector_layer),
tool);
G_CALLBACK (gimp_path_tool_create_vector_layer),
tool);
gtk_widget_set_sensitive (options->vector_layer_button, TRUE);
}