Commit f1d89f71 authored by Sven Neumann's avatar Sven Neumann

Bug 626446 - segfaults when started with -i argument

We don't need a standard tool-preset object, so just remove the
code that was copied and pasted from other GimpData objects.
Fixes the crash on startup in non-interactive mode.
parent cd192adf
......@@ -660,7 +660,7 @@ gimp_real_initialize (Gimp *gimp,
tool_preset_loader_entries,
G_N_ELEMENTS (tool_preset_loader_entries),
gimp_tool_preset_new,
gimp_tool_preset_get_standard);
NULL);
gimp_object_set_static_name (GIMP_OBJECT (gimp->tool_preset_factory),
"tool preset factory");
......
......@@ -1675,7 +1675,6 @@ gimp_context_copy_property (GimpContext *src,
case GIMP_CONTEXT_PROP_TOOL_PRESET:
gimp_context_real_set_tool_preset (dest, src->tool_preset);
object = src->tool_preset;
standard_object = gimp_tool_preset_get_standard (src);
src_name = src->tool_preset_name;
dest_name_loc = &dest->tool_preset_name;
break;
......@@ -3105,12 +3104,8 @@ gimp_context_tool_preset_list_thaw (GimpContainer *container,
{
GimpToolPreset *tool_preset;
if (! context->tool_preset_name)
context->tool_preset_name = g_strdup (context->gimp->config->default_tool_preset);
tool_preset = gimp_context_find_object (context, container,
context->tool_preset_name,
gimp_tool_preset_get_standard (context));
context->tool_preset_name, NULL);
gimp_context_real_set_tool_preset (context, tool_preset);
}
......@@ -3122,8 +3117,7 @@ gimp_context_real_set_tool_preset (GimpContext *context,
if (context->tool_preset == tool_preset)
return;
if (context->tool_preset_name &&
tool_preset != GIMP_TOOL_PRESET (gimp_tool_preset_get_standard (context)))
if (context->tool_preset_name)
{
g_free (context->tool_preset_name);
context->tool_preset_name = NULL;
......@@ -3149,8 +3143,7 @@ gimp_context_real_set_tool_preset (GimpContext *context,
context,
0);
if (tool_preset != GIMP_TOOL_PRESET (gimp_tool_preset_get_standard (context)))
context->tool_preset_name = g_strdup (gimp_object_get_name (tool_preset));
context->tool_preset_name = g_strdup (gimp_object_get_name (tool_preset));
}
g_object_notify (G_OBJECT (context), "tool-preset");
......
......@@ -421,6 +421,8 @@ gimp_tool_preset_new (GimpContext *context,
tool_info = gimp_context_get_tool (context);
g_return_val_if_fail (tool_info != NULL, NULL);
stock_id = gimp_viewable_get_stock_id (GIMP_VIEWABLE (tool_info));
return g_object_new (GIMP_TYPE_TOOL_PRESET,
......@@ -431,28 +433,6 @@ gimp_tool_preset_new (GimpContext *context,
NULL);
}
GimpData *
gimp_tool_preset_get_standard (GimpContext *context)
{
static GimpData *standard_tool_preset = NULL;
g_return_val_if_fail (GIMP_IS_CONTEXT (context), NULL);
if (! standard_tool_preset)
{
standard_tool_preset = gimp_tool_preset_new (context,
"Standard tool preset");
gimp_data_clean (standard_tool_preset);
gimp_data_make_internal (standard_tool_preset, "gimp-tool-preset-standard");
g_object_add_weak_pointer (G_OBJECT (standard_tool_preset),
(gpointer *) &standard_tool_preset);
}
return standard_tool_preset;
}
GimpContextPropMask
gimp_tool_preset_get_prop_mask (GimpToolPreset *preset)
{
......
......@@ -58,7 +58,6 @@ GType gimp_tool_preset_get_type (void) G_GNUC_CONST;
GimpData * gimp_tool_preset_new (GimpContext *context,
const gchar *name);
GimpData * gimp_tool_preset_get_standard (GimpContext *context);
GimpContextPropMask gimp_tool_preset_get_prop_mask (GimpToolPreset *preset);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment