[gimp] Bug 626446 - segfaults when started with -i argument
- From: Sven Neumann <neo src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] Bug 626446 - segfaults when started with -i argument
- Date: Wed, 25 Aug 2010 20:11:11 +0000 (UTC)
commit f1d89f712dd75a5e759f5923119500296ed9bd25
Author: Sven Neumann <sven gimp org>
Date: Wed Aug 25 21:41:14 2010 +0200
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.
app/core/gimp.c | 2 +-
app/core/gimpcontext.c | 13 +++----------
app/core/gimptoolpreset.c | 24 ++----------------------
app/core/gimptoolpreset.h | 1 -
4 files changed, 6 insertions(+), 34 deletions(-)
---
diff --git a/app/core/gimp.c b/app/core/gimp.c
index 85efa9a..1992b31 100644
--- a/app/core/gimp.c
+++ b/app/core/gimp.c
@@ -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");
diff --git a/app/core/gimpcontext.c b/app/core/gimpcontext.c
index aaf40bc..c90eb77 100644
--- a/app/core/gimpcontext.c
+++ b/app/core/gimpcontext.c
@@ -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");
diff --git a/app/core/gimptoolpreset.c b/app/core/gimptoolpreset.c
index e37798d..42221d5 100644
--- a/app/core/gimptoolpreset.c
+++ b/app/core/gimptoolpreset.c
@@ -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)
{
diff --git a/app/core/gimptoolpreset.h b/app/core/gimptoolpreset.h
index 485db02..3955bce 100644
--- a/app/core/gimptoolpreset.h
+++ b/app/core/gimptoolpreset.h
@@ -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);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]