app: fix crash on invalid previously picked layer.
This happened to our artist in residency. She had a crash when gimp_image_pick_layer() was apparently run with a non-NULL yet invalid previously_picked layer. So let's make sure that we clear the stored item pointer when the object gets finalized.
This commit is contained in:
parent
4dceeb174a
commit
bb9aad1e87
2 changed files with 4 additions and 3 deletions
|
|
@ -1052,7 +1052,7 @@ gimp_display_shell_canvas_tool_events (GtkWidget *canvas,
|
|||
|
||||
if (gimp_display_shell_key_to_state (kevent->keyval) == GDK_MOD1_MASK)
|
||||
/* Make sure the picked layer is reset. */
|
||||
shell->picked_layer = NULL;
|
||||
g_clear_weak_pointer (&shell->picked_layer);
|
||||
|
||||
switch (kevent->keyval)
|
||||
{
|
||||
|
|
@ -1151,7 +1151,7 @@ gimp_display_shell_canvas_tool_events (GtkWidget *canvas,
|
|||
statusbar = gimp_display_shell_get_statusbar (shell);
|
||||
gimp_statusbar_pop_temp (statusbar);
|
||||
|
||||
shell->picked_layer = NULL;
|
||||
g_clear_weak_pointer (&shell->picked_layer);
|
||||
shell->mod_action = GIMP_MODIFIER_ACTION_NONE;
|
||||
}
|
||||
else if (shell->mod_action != GIMP_MODIFIER_ACTION_NONE &&
|
||||
|
|
@ -1767,7 +1767,7 @@ gimp_display_shell_start_scrolling (GimpDisplayShell *shell,
|
|||
_("Layer picked: '%s'"),
|
||||
gimp_object_get_name (layer));
|
||||
}
|
||||
shell->picked_layer = layer;
|
||||
g_set_weak_pointer (&shell->picked_layer, layer);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -920,6 +920,7 @@ gimp_display_shell_finalize (GObject *object)
|
|||
g_clear_object (&shell->no_image_options);
|
||||
g_clear_pointer (&shell->title, g_free);
|
||||
g_clear_pointer (&shell->status, g_free);
|
||||
g_clear_weak_pointer (&shell->picked_layer);
|
||||
|
||||
G_OBJECT_CLASS (parent_class)->finalize (object);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue