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.
This commit is contained in:
Sven Neumann 2010-08-25 21:41:14 +02:00
parent cd192adf09
commit f1d89f712d
4 changed files with 6 additions and 34 deletions

View File

@ -660,7 +660,7 @@ gimp_real_initialize (Gimp *gimp,
tool_preset_loader_entries, tool_preset_loader_entries,
G_N_ELEMENTS (tool_preset_loader_entries), G_N_ELEMENTS (tool_preset_loader_entries),
gimp_tool_preset_new, gimp_tool_preset_new,
gimp_tool_preset_get_standard); NULL);
gimp_object_set_static_name (GIMP_OBJECT (gimp->tool_preset_factory), gimp_object_set_static_name (GIMP_OBJECT (gimp->tool_preset_factory),
"tool preset factory"); "tool preset factory");

View File

@ -1675,7 +1675,6 @@ gimp_context_copy_property (GimpContext *src,
case GIMP_CONTEXT_PROP_TOOL_PRESET: case GIMP_CONTEXT_PROP_TOOL_PRESET:
gimp_context_real_set_tool_preset (dest, src->tool_preset); gimp_context_real_set_tool_preset (dest, src->tool_preset);
object = src->tool_preset; object = src->tool_preset;
standard_object = gimp_tool_preset_get_standard (src);
src_name = src->tool_preset_name; src_name = src->tool_preset_name;
dest_name_loc = &dest->tool_preset_name; dest_name_loc = &dest->tool_preset_name;
break; break;
@ -3105,12 +3104,8 @@ gimp_context_tool_preset_list_thaw (GimpContainer *container,
{ {
GimpToolPreset *tool_preset; 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, tool_preset = gimp_context_find_object (context, container,
context->tool_preset_name, context->tool_preset_name, NULL);
gimp_tool_preset_get_standard (context));
gimp_context_real_set_tool_preset (context, tool_preset); 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) if (context->tool_preset == tool_preset)
return; return;
if (context->tool_preset_name && if (context->tool_preset_name)
tool_preset != GIMP_TOOL_PRESET (gimp_tool_preset_get_standard (context)))
{ {
g_free (context->tool_preset_name); g_free (context->tool_preset_name);
context->tool_preset_name = NULL; context->tool_preset_name = NULL;
@ -3149,7 +3143,6 @@ gimp_context_real_set_tool_preset (GimpContext *context,
context, context,
0); 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));
} }

View File

@ -421,6 +421,8 @@ gimp_tool_preset_new (GimpContext *context,
tool_info = gimp_context_get_tool (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)); stock_id = gimp_viewable_get_stock_id (GIMP_VIEWABLE (tool_info));
return g_object_new (GIMP_TYPE_TOOL_PRESET, return g_object_new (GIMP_TYPE_TOOL_PRESET,
@ -431,28 +433,6 @@ gimp_tool_preset_new (GimpContext *context,
NULL); 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 GimpContextPropMask
gimp_tool_preset_get_prop_mask (GimpToolPreset *preset) gimp_tool_preset_get_prop_mask (GimpToolPreset *preset)
{ {

View File

@ -58,7 +58,6 @@ GType gimp_tool_preset_get_type (void) G_GNUC_CONST;
GimpData * gimp_tool_preset_new (GimpContext *context, GimpData * gimp_tool_preset_new (GimpContext *context,
const gchar *name); const gchar *name);
GimpData * gimp_tool_preset_get_standard (GimpContext *context);
GimpContextPropMask gimp_tool_preset_get_prop_mask (GimpToolPreset *preset); GimpContextPropMask gimp_tool_preset_get_prop_mask (GimpToolPreset *preset);