Commit 80fbb0f1 authored by Michael Natterer's avatar Michael Natterer 😴 Committed by Michael Natterer

some general cleanup.

2004-02-28  Michael Natterer  <mitch@gimp.org>

	* app/widgets/gimpcellrendererviewable.c: some general cleanup.

	(gimp_cell_renderer_viewable_set_property): ref the new renderer
	before unrefing the old one. Fixes potential crash when setting
	the same renderer again.
parent abee5eef
2004-02-28 Michael Natterer <mitch@gimp.org>
* app/widgets/gimpcellrendererviewable.c: some general cleanup.
(gimp_cell_renderer_viewable_set_property): ref the new renderer
before unrefing the old one. Fixes potential crash when setting
the same renderer again.
2004-02-28 Michael Natterer <mitch@gimp.org> 2004-02-28 Michael Natterer <mitch@gimp.org>
* app/core/gimplayer.c (gimp_layer_apply_mask): when deleting the * app/core/gimplayer.c (gimp_layer_apply_mask): when deleting the
...@@ -117,23 +117,20 @@ gimp_cell_renderer_viewable_get_type (void) ...@@ -117,23 +117,20 @@ gimp_cell_renderer_viewable_get_type (void)
static void static void
gimp_cell_renderer_viewable_class_init (GimpCellRendererViewableClass *klass) gimp_cell_renderer_viewable_class_init (GimpCellRendererViewableClass *klass)
{ {
GObjectClass *object_class; GObjectClass *object_class = G_OBJECT_CLASS (klass);
GtkCellRendererClass *cell_class; GtkCellRendererClass *cell_class = GTK_CELL_RENDERER_CLASS (klass);
object_class = G_OBJECT_CLASS (klass);
cell_class = GTK_CELL_RENDERER_CLASS (klass);
parent_class = g_type_class_peek_parent (klass); parent_class = g_type_class_peek_parent (klass);
viewable_cell_signals[CLICKED] = viewable_cell_signals[CLICKED] =
g_signal_new ("clicked", g_signal_new ("clicked",
G_OBJECT_CLASS_TYPE (object_class), G_OBJECT_CLASS_TYPE (object_class),
G_SIGNAL_RUN_LAST, G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (GimpCellRendererViewableClass, clicked), G_STRUCT_OFFSET (GimpCellRendererViewableClass, clicked),
NULL, NULL, NULL, NULL,
gimp_marshal_VOID__STRING_FLAGS, gimp_marshal_VOID__STRING_FLAGS,
G_TYPE_NONE, 2, G_TYPE_NONE, 2,
G_TYPE_STRING, G_TYPE_STRING,
GDK_TYPE_MODIFIER_TYPE); GDK_TYPE_MODIFIER_TYPE);
object_class->finalize = gimp_cell_renderer_viewable_finalize; object_class->finalize = gimp_cell_renderer_viewable_finalize;
...@@ -163,9 +160,7 @@ gimp_cell_renderer_viewable_init (GimpCellRendererViewable *cellviewable) ...@@ -163,9 +160,7 @@ gimp_cell_renderer_viewable_init (GimpCellRendererViewable *cellviewable)
static void static void
gimp_cell_renderer_viewable_finalize (GObject *object) gimp_cell_renderer_viewable_finalize (GObject *object)
{ {
GimpCellRendererViewable *cell; GimpCellRendererViewable *cell = GIMP_CELL_RENDERER_VIEWABLE (object);
cell = GIMP_CELL_RENDERER_VIEWABLE (object);
if (cell->renderer) if (cell->renderer)
{ {
...@@ -182,9 +177,7 @@ gimp_cell_renderer_viewable_get_property (GObject *object, ...@@ -182,9 +177,7 @@ gimp_cell_renderer_viewable_get_property (GObject *object,
GValue *value, GValue *value,
GParamSpec *pspec) GParamSpec *pspec)
{ {
GimpCellRendererViewable *cell; GimpCellRendererViewable *cell = GIMP_CELL_RENDERER_VIEWABLE (object);
cell = GIMP_CELL_RENDERER_VIEWABLE (object);
switch (param_id) switch (param_id)
{ {
...@@ -204,16 +197,19 @@ gimp_cell_renderer_viewable_set_property (GObject *object, ...@@ -204,16 +197,19 @@ gimp_cell_renderer_viewable_set_property (GObject *object,
const GValue *value, const GValue *value,
GParamSpec *pspec) GParamSpec *pspec)
{ {
GimpCellRendererViewable *cell; GimpCellRendererViewable *cell = GIMP_CELL_RENDERER_VIEWABLE (object);
cell = GIMP_CELL_RENDERER_VIEWABLE (object);
switch (param_id) switch (param_id)
{ {
case PROP_RENDERER: case PROP_RENDERER:
if (cell->renderer) {
g_object_unref (cell->renderer); GimpPreviewRenderer *renderer;
cell->renderer = (GimpPreviewRenderer *) g_value_dup_object (value);
renderer = (GimpPreviewRenderer *) g_value_dup_object (value);
if (cell->renderer)
g_object_unref (cell->renderer);
cell->renderer = renderer;
}
break; break;
default: default:
......
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