Bug 795493 - Warning when removing a text layer
In gimp_text_tool_connect(), when auto-removing empty text layers upon text layer or tool change, make sure we don't try to remove a layer that has already been removed, which can happen if this function is reached *because* somehow the layer was removed externally (e.g. by the user in the layers dialog).
This commit is contained in:
@ -1186,19 +1186,29 @@ gimp_text_tool_connect (GimpTextTool *text_tool,
|
|||||||
if (text_tool->layer != layer)
|
if (text_tool->layer != layer)
|
||||||
{
|
{
|
||||||
if (text_tool->layer)
|
if (text_tool->layer)
|
||||||
|
{
|
||||||
g_signal_handlers_disconnect_by_func (text_tool->layer,
|
g_signal_handlers_disconnect_by_func (text_tool->layer,
|
||||||
gimp_text_tool_layer_notify,
|
gimp_text_tool_layer_notify,
|
||||||
text_tool);
|
text_tool);
|
||||||
|
|
||||||
|
/* don't try to remove the layer if it is not attached,
|
||||||
|
* which can happen if we got here because the layer was
|
||||||
|
* somehow deleted from the image (like by the user in the
|
||||||
|
* layers dialog).
|
||||||
|
*/
|
||||||
|
if (gimp_item_is_attached (GIMP_ITEM (text_tool->layer)))
|
||||||
gimp_text_tool_remove_empty_text_layer (text_tool);
|
gimp_text_tool_remove_empty_text_layer (text_tool);
|
||||||
|
}
|
||||||
|
|
||||||
text_tool->layer = layer;
|
text_tool->layer = layer;
|
||||||
|
|
||||||
if (layer)
|
if (layer)
|
||||||
|
{
|
||||||
g_signal_connect_object (text_tool->layer, "notify",
|
g_signal_connect_object (text_tool->layer, "notify",
|
||||||
G_CALLBACK (gimp_text_tool_layer_notify),
|
G_CALLBACK (gimp_text_tool_layer_notify),
|
||||||
text_tool, 0);
|
text_tool, 0);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
Reference in New Issue
Block a user