Commit c9bde335 authored by Michael Natterer's avatar Michael Natterer 😴

app: don't additionally ref the standard data objects

Instead, set their statically remembered pointer as a weak pointer so
it's nullified automatically if they are ever finalized. Doesn't
actually get rid of them upon exit yet, this is just a preparation.
parent 5da440f1
......@@ -421,7 +421,8 @@ gimp_brush_get_standard (GimpContext *context)
gimp_data_clean (standard_brush);
gimp_data_make_internal (standard_brush, "gimp-brush-standard");
g_object_ref (standard_brush);
g_object_add_weak_pointer (G_OBJECT (standard_brush),
(gpointer *) &standard_brush);
}
return standard_brush;
......
......@@ -422,7 +422,8 @@ gimp_dynamics_get_standard (GimpContext *context)
gimp_data_clean (standard_dynamics);
gimp_data_make_internal (standard_dynamics, "gimp-dynamics-standard");
g_object_ref (standard_dynamics);
g_object_add_weak_pointer (G_OBJECT (standard_dynamics),
(gpointer *) &standard_dynamics);
}
return standard_dynamics;
......
......@@ -351,7 +351,8 @@ gimp_gradient_get_standard (GimpContext *context)
gimp_data_clean (standard_gradient);
gimp_data_make_internal (standard_gradient, "gimp-gradient-standard");
g_object_ref (standard_gradient);
g_object_add_weak_pointer (G_OBJECT (standard_gradient),
(gpointer *) &standard_gradient);
}
return standard_gradient;
......
......@@ -295,7 +295,8 @@ gimp_palette_get_standard (GimpContext *context)
gimp_data_clean (standard_palette);
gimp_data_make_internal (standard_palette, "gimp-palette-standard");
g_object_ref (standard_palette);
g_object_add_weak_pointer (G_OBJECT (standard_palette),
(gpointer *) &standard_palette);
}
return standard_palette;
......
......@@ -249,7 +249,8 @@ gimp_pattern_get_standard (GimpContext *context)
gimp_data_clean (standard_pattern);
gimp_data_make_internal (standard_pattern, "gimp-pattern-standard");
g_object_ref (standard_pattern);
g_object_add_weak_pointer (G_OBJECT (standard_pattern),
(gpointer *) &standard_pattern);
}
return standard_pattern;
......
......@@ -446,7 +446,8 @@ gimp_tool_preset_get_standard (GimpContext *context)
gimp_data_clean (standard_tool_preset);
gimp_data_make_internal (standard_tool_preset, "gimp-tool-preset-standard");
g_object_ref (standard_tool_preset);
g_object_add_weak_pointer (G_OBJECT (standard_tool_preset),
(gpointer *) &standard_tool_preset);
}
return standard_tool_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