split "destroy" up in "dispose" and "finalize".

2001-08-11  Michael Natterer  <mitch@gimp.org>

	* app/core/gimp.c: split "destroy" up in "dispose" and "finalize".

	* app/core/gimpcontext.c: objects need to be passed around with
	g_param_spec_object() or bad things will happen.

	* app/gui/channels-commands.c
	* app/gui/edit-commands.c
	* app/gui/file-commands.c
	* app/gui/gui.c
	* app/gui/layers-commands.c
	* app/gui/resize-dialog.c
	* app/gui/select-commands.c
	* app/tools/gimpclonetool.c
	* app/widgets/gimpdatafactoryview.c
	* app/widgets/gimppreview.c: removed many connections to
	"destroy": Connect to "dispose" or use g_object_weak_ref()
	instead.
This commit is contained in:
Michael Natterer 2001-08-11 21:10:44 +00:00 committed by Michael Natterer
parent 5e74fa373a
commit da68142ee9
25 changed files with 226 additions and 178 deletions

View File

@ -1,3 +1,23 @@
2001-08-11 Michael Natterer <mitch@gimp.org>
* app/core/gimp.c: split "destroy" up in "dispose" and "finalize".
* app/core/gimpcontext.c: objects need to be passed around with
g_param_spec_object() or bad things will happen.
* app/gui/channels-commands.c
* app/gui/edit-commands.c
* app/gui/file-commands.c
* app/gui/gui.c
* app/gui/layers-commands.c
* app/gui/resize-dialog.c
* app/gui/select-commands.c
* app/tools/gimpclonetool.c
* app/widgets/gimpdatafactoryview.c
* app/widgets/gimppreview.c: removed many connections to
"destroy": Connect to "dispose" or use g_object_weak_ref()
instead.
2001-08-11 Michael Natterer <mitch@gimp.org>
* configure.in: fsck^^^ -- lovely autofoo wants "changequote([,])dnl"

View File

@ -360,9 +360,9 @@ channels_new_channel_query (GimpImage *gimage)
NULL);
g_signal_connect_swapped (G_OBJECT (options->query_box), "destroy",
G_CALLBACK (g_free),
options);
g_object_weak_ref (G_OBJECT (options->query_box),
(GWeakNotify) g_free,
options);
/* The main hbox */
hbox = gtk_hbox_new (FALSE, 2);
@ -513,9 +513,9 @@ channels_edit_channel_query (GimpChannel *channel)
NULL);
g_signal_connect_swapped (G_OBJECT (options->query_box), "destroy",
G_CALLBACK (g_free),
options);
g_object_weak_ref (G_OBJECT (options->query_box),
(GWeakNotify) g_free,
options);
g_signal_connect_object (G_OBJECT (channel), "removed",
G_CALLBACK (gtk_widget_destroy),

View File

@ -193,7 +193,7 @@ edit_named_cut_cmd_callback (GtkWidget *widget,
"dialogs/cut_named.html",
_("Enter a name for this buffer"),
NULL,
G_OBJECT (gdisp->gimage), "destroy",
G_OBJECT (gdisp->gimage), "disconnect",
cut_named_buffer_callback, gdisp->gimage);
gtk_widget_show (qbox);
}
@ -212,7 +212,7 @@ edit_named_copy_cmd_callback (GtkWidget *widget,
"dialogs/copy_named.html",
_("Enter a name for this buffer"),
NULL,
G_OBJECT (gdisp->gimage), "destroy",
G_OBJECT (gdisp->gimage), "disconnect",
copy_named_buffer_callback, gdisp->gimage);
gtk_widget_show (qbox);
}

View File

@ -234,7 +234,8 @@ file_revert_cmd_callback (GtkWidget *widget,
FALSE,
text,
GTK_STOCK_YES, GTK_STOCK_NO,
G_OBJECT (gdisp->gimage), "destroy",
G_OBJECT (gdisp->gimage),
"disconnect",
file_revert_confirm_callback,
gdisp->gimage);

View File

@ -594,9 +594,9 @@ layers_new_layer_query (GimpImage *gimage)
NULL);
g_signal_connect_swapped (G_OBJECT (options->query_box), "destroy",
G_CALLBACK (g_free),
options);
g_object_weak_ref (G_OBJECT (options->query_box),
(GWeakNotify) g_free,
options);
/* The main vbox */
vbox = gtk_vbox_new (FALSE, 2);
@ -777,9 +777,9 @@ layers_edit_layer_query (GimpLayer *layer)
NULL);
g_signal_connect_swapped (G_OBJECT (options->query_box), "destroy",
G_CALLBACK (g_free),
options);
g_object_weak_ref (G_OBJECT (options->query_box),
(GWeakNotify) g_free,
options);
g_signal_connect_object (G_OBJECT (layer), "removed",
G_CALLBACK (gtk_widget_destroy),
@ -882,9 +882,9 @@ layers_add_mask_query (GimpLayer *layer)
NULL);
g_signal_connect_swapped (G_OBJECT (options->query_box), "destroy",
G_CALLBACK (g_free),
options);
g_object_weak_ref (G_OBJECT (options->query_box),
(GWeakNotify) g_free,
options);
g_signal_connect_object (G_OBJECT (layer), "removed",
G_CALLBACK (gtk_widget_destroy),
@ -1018,9 +1018,9 @@ layers_scale_layer_query (GimpImage *gimage,
NULL,
options);
g_signal_connect_swapped (G_OBJECT (options->resize->resize_shell), "destroy",
G_CALLBACK (g_free),
options);
g_object_weak_ref (G_OBJECT (options->resize->resize_shell),
(GWeakNotify) g_free,
options);
gtk_widget_show (options->resize->resize_shell);
}
@ -1106,9 +1106,9 @@ layers_resize_layer_query (GimpImage *gimage,
NULL,
options);
g_signal_connect_swapped (G_OBJECT (options->resize->resize_shell), "destroy",
G_CALLBACK (g_free),
options);
g_object_weak_ref (G_OBJECT (options->resize->resize_shell),
(GWeakNotify) g_free,
options);
gtk_widget_show (options->resize->resize_shell);
}
@ -1176,9 +1176,9 @@ layers_layer_merge_query (GimpImage *gimage,
NULL);
g_signal_connect_swapped (G_OBJECT (options->query_box), "destroy",
G_CALLBACK (g_free),
options);
g_object_weak_ref (G_OBJECT (options->query_box),
(GWeakNotify) g_free,
options);
/* The main vbox */
vbox = gtk_vbox_new (FALSE, 2);

View File

@ -131,7 +131,7 @@ select_feather_cmd_callback (GtkWidget *widget,
MIN (gdisp->gimage->xresolution,
gdisp->gimage->yresolution),
gdisp->dot_for_dot,
G_OBJECT (gdisp->gimage), "destroy",
G_OBJECT (gdisp->gimage), "disconnect",
gimage_mask_feather_callback, gdisp->gimage);
gtk_widget_show (qbox);
}
@ -167,7 +167,7 @@ select_shrink_cmd_callback (GtkWidget *widget,
MIN (gdisp->gimage->xresolution,
gdisp->gimage->yresolution),
gdisp->dot_for_dot,
G_OBJECT (gdisp->gimage), "destroy",
G_OBJECT (gdisp->gimage), "disconnect",
gimage_mask_shrink_callback, gdisp->gimage);
edge_lock = gtk_check_button_new_with_label (_("Shrink from image border"));
@ -201,7 +201,7 @@ select_grow_cmd_callback (GtkWidget *widget,
MIN (gdisp->gimage->xresolution,
gdisp->gimage->yresolution),
gdisp->dot_for_dot,
G_OBJECT (gdisp->gimage), "destroy",
G_OBJECT (gdisp->gimage), "disconnect",
gimage_mask_grow_callback, gdisp->gimage);
gtk_widget_show (qbox);
}
@ -224,7 +224,7 @@ select_border_cmd_callback (GtkWidget *widget,
MIN (gdisp->gimage->xresolution,
gdisp->gimage->yresolution),
gdisp->dot_for_dot,
G_OBJECT (gdisp->gimage), "destroy",
G_OBJECT (gdisp->gimage), "disconnect",
gimage_mask_border_callback, gdisp->gimage);
gtk_widget_show (qbox);
}

View File

@ -55,13 +55,14 @@
#include "libgimp/gimpintl.h"
static void gimp_class_init (GimpClass *klass);
static void gimp_init (Gimp *gimp);
static void gimp_class_init (GimpClass *klass);
static void gimp_init (Gimp *gimp);
static void gimp_destroy (GtkObject *object);
static void gimp_dispose (GObject *object);
static void gimp_finalize (GObject *object);
static void gimp_context_destroy_callback (GimpContext *context,
Gimp *gimp);
static void gimp_context_disconnect_callback (GimpContext *context,
Gimp *gimp);
static GimpObjectClass *parent_class = NULL;
@ -98,13 +99,14 @@ gimp_get_type (void)
static void
gimp_class_init (GimpClass *klass)
{
GtkObjectClass *object_class;
GObjectClass *object_class;
object_class = (GtkObjectClass *) klass;
object_class = G_OBJECT_CLASS (klass);
parent_class = g_type_class_peek_parent (klass);
object_class->destroy = gimp_destroy;
object_class->dispose = gimp_dispose;
object_class->finalize = gimp_finalize;
}
static void
@ -167,7 +169,29 @@ gimp_init (Gimp *gimp)
}
static void
gimp_destroy (GtkObject *object)
gimp_dispose (GObject *object)
{
Gimp *gimp;
gimp = GIMP (object);
if (gimp->brush_factory)
gimp_data_factory_data_free (gimp->brush_factory);
if (gimp->pattern_factory)
gimp_data_factory_data_free (gimp->pattern_factory);
if (gimp->gradient_factory)
gimp_data_factory_data_free (gimp->gradient_factory);
if (gimp->palette_factory)
gimp_data_factory_data_free (gimp->palette_factory);
G_OBJECT_CLASS (parent_class)->dispose (object);
}
static void
gimp_finalize (GObject *object)
{
Gimp *gimp;
@ -205,28 +229,24 @@ gimp_destroy (GtkObject *object)
if (gimp->brush_factory)
{
gimp_data_factory_data_free (gimp->brush_factory);
g_object_unref (G_OBJECT (gimp->brush_factory));
gimp->brush_factory = NULL;
}
if (gimp->pattern_factory)
{
gimp_data_factory_data_free (gimp->pattern_factory);
g_object_unref (G_OBJECT (gimp->pattern_factory));
gimp->pattern_factory = NULL;
}
if (gimp->gradient_factory)
{
gimp_data_factory_data_free (gimp->gradient_factory);
g_object_unref (G_OBJECT (gimp->gradient_factory));
gimp->gradient_factory = NULL;
}
if (gimp->palette_factory)
{
gimp_data_factory_data_free (gimp->palette_factory);
g_object_unref (G_OBJECT (gimp->palette_factory));
gimp->palette_factory = NULL;
}
@ -267,8 +287,7 @@ gimp_destroy (GtkObject *object)
if (gimp->user_units)
gimp_units_exit (gimp);
if (GTK_OBJECT_CLASS (parent_class)->destroy)
GTK_OBJECT_CLASS (parent_class)->destroy (object);
G_OBJECT_CLASS (parent_class)->finalize (object);
}
Gimp *
@ -594,8 +613,8 @@ gimp_create_context (Gimp *gimp,
gimp->context_list = g_list_prepend (gimp->context_list, context);
g_signal_connect_object (G_OBJECT (context), "destroy",
G_CALLBACK (gimp_context_destroy_callback),
g_signal_connect_object (G_OBJECT (context), "disconnect",
G_CALLBACK (gimp_context_disconnect_callback),
G_OBJECT (gimp),
0);
@ -603,8 +622,8 @@ gimp_create_context (Gimp *gimp,
}
static void
gimp_context_destroy_callback (GimpContext *context,
Gimp *gimp)
gimp_context_disconnect_callback (GimpContext *context,
Gimp *gimp)
{
gimp->context_list = g_list_remove (gimp->context_list, context);
}

View File

@ -355,9 +355,9 @@ gimp_context_class_init (GimpContextClass *klass)
G_SIGNAL_RUN_FIRST,
G_STRUCT_OFFSET (GimpContextClass, image_changed),
NULL, NULL,
g_cclosure_marshal_VOID__POINTER,
g_cclosure_marshal_VOID__OBJECT,
G_TYPE_NONE, 1,
G_TYPE_POINTER);
G_TYPE_OBJECT);
gimp_context_signals[DISPLAY_CHANGED] =
g_signal_new (gimp_context_signal_names[DISPLAY_CHANGED],
@ -375,9 +375,9 @@ gimp_context_class_init (GimpContextClass *klass)
G_SIGNAL_RUN_FIRST,
G_STRUCT_OFFSET (GimpContextClass, tool_changed),
NULL, NULL,
g_cclosure_marshal_VOID__POINTER,
g_cclosure_marshal_VOID__OBJECT,
G_TYPE_NONE, 1,
G_TYPE_POINTER);
G_TYPE_OBJECT);
gimp_context_signals[FOREGROUND_CHANGED] =
g_signal_new (gimp_context_signal_names[FOREGROUND_CHANGED],
@ -425,9 +425,9 @@ gimp_context_class_init (GimpContextClass *klass)
G_SIGNAL_RUN_FIRST,
G_STRUCT_OFFSET (GimpContextClass, brush_changed),
NULL, NULL,
g_cclosure_marshal_VOID__POINTER,
g_cclosure_marshal_VOID__OBJECT,
G_TYPE_NONE, 1,
G_TYPE_POINTER);
G_TYPE_OBJECT);
gimp_context_signals[PATTERN_CHANGED] =
g_signal_new (gimp_context_signal_names[PATTERN_CHANGED],
@ -435,9 +435,9 @@ gimp_context_class_init (GimpContextClass *klass)
G_SIGNAL_RUN_FIRST,
G_STRUCT_OFFSET (GimpContextClass, pattern_changed),
NULL, NULL,
g_cclosure_marshal_VOID__POINTER,
g_cclosure_marshal_VOID__OBJECT,
G_TYPE_NONE, 1,
G_TYPE_POINTER);
G_TYPE_OBJECT);
gimp_context_signals[GRADIENT_CHANGED] =
g_signal_new (gimp_context_signal_names[GRADIENT_CHANGED],
@ -445,9 +445,9 @@ gimp_context_class_init (GimpContextClass *klass)
G_SIGNAL_RUN_FIRST,
G_STRUCT_OFFSET (GimpContextClass, gradient_changed),
NULL, NULL,
g_cclosure_marshal_VOID__POINTER,
g_cclosure_marshal_VOID__OBJECT,
G_TYPE_NONE, 1,
G_TYPE_POINTER);
G_TYPE_OBJECT);
gimp_context_signals[PALETTE_CHANGED] =
g_signal_new (gimp_context_signal_names[PALETTE_CHANGED],
@ -455,9 +455,9 @@ gimp_context_class_init (GimpContextClass *klass)
G_SIGNAL_RUN_FIRST,
G_STRUCT_OFFSET (GimpContextClass, palette_changed),
NULL, NULL,
g_cclosure_marshal_VOID__POINTER,
g_cclosure_marshal_VOID__OBJECT,
G_TYPE_NONE, 1,
G_TYPE_POINTER);
G_TYPE_OBJECT);
gimp_context_signals[BUFFER_CHANGED] =
g_signal_new (gimp_context_signal_names[BUFFER_CHANGED],
@ -465,9 +465,9 @@ gimp_context_class_init (GimpContextClass *klass)
G_SIGNAL_RUN_FIRST,
G_STRUCT_OFFSET (GimpContextClass, buffer_changed),
NULL, NULL,
g_cclosure_marshal_VOID__POINTER,
g_cclosure_marshal_VOID__OBJECT,
G_TYPE_NONE, 1,
G_TYPE_POINTER);
G_TYPE_OBJECT);
object_class->set_property = gimp_context_set_property;
object_class->get_property = gimp_context_get_property;
@ -496,9 +496,10 @@ gimp_context_class_init (GimpContextClass *klass)
g_object_class_install_property (object_class,
PROP_IMAGE,
g_param_spec_pointer (gimp_context_prop_names[IMAGE_CHANGED],
NULL, NULL,
G_PARAM_READWRITE));
g_param_spec_object (gimp_context_prop_names[IMAGE_CHANGED],
NULL, NULL,
GIMP_TYPE_IMAGE,
G_PARAM_READWRITE));
g_object_class_install_property (object_class,
PROP_DISPLAY,
@ -508,9 +509,10 @@ gimp_context_class_init (GimpContextClass *klass)
g_object_class_install_property (object_class,
PROP_TOOL,
g_param_spec_pointer (gimp_context_prop_names[TOOL_CHANGED],
NULL, NULL,
G_PARAM_READWRITE));
g_param_spec_object (gimp_context_prop_names[TOOL_CHANGED],
NULL, NULL,
GIMP_TYPE_TOOL_INFO,
G_PARAM_READWRITE));
g_object_class_install_property (object_class,
PROP_FOREGROUND,
@ -544,33 +546,38 @@ gimp_context_class_init (GimpContextClass *klass)
g_object_class_install_property (object_class,
PROP_BRUSH,
g_param_spec_pointer (gimp_context_prop_names[BRUSH_CHANGED],
NULL, NULL,
G_PARAM_READWRITE));
g_param_spec_object (gimp_context_prop_names[BRUSH_CHANGED],
NULL, NULL,
GIMP_TYPE_BRUSH,
G_PARAM_READWRITE));
g_object_class_install_property (object_class,
PROP_PATTERN,
g_param_spec_pointer (gimp_context_prop_names[PATTERN_CHANGED],
NULL, NULL,
G_PARAM_READWRITE));
g_param_spec_object (gimp_context_prop_names[PATTERN_CHANGED],
NULL, NULL,
GIMP_TYPE_PATTERN,
G_PARAM_READWRITE));
g_object_class_install_property (object_class,
PROP_GRADIENT,
g_param_spec_pointer (gimp_context_prop_names[GRADIENT_CHANGED],
NULL, NULL,
G_PARAM_READWRITE));
g_param_spec_object (gimp_context_prop_names[GRADIENT_CHANGED],
NULL, NULL,
GIMP_TYPE_GRADIENT,
G_PARAM_READWRITE));
g_object_class_install_property (object_class,
PROP_PALETTE,
g_param_spec_pointer (gimp_context_prop_names[PALETTE_CHANGED],
NULL, NULL,
G_PARAM_READWRITE));
g_param_spec_object (gimp_context_prop_names[PALETTE_CHANGED],
NULL, NULL,
GIMP_TYPE_PALETTE,
G_PARAM_READWRITE));
g_object_class_install_property (object_class,
PROP_BUFFER,
g_param_spec_pointer (gimp_context_prop_names[BUFFER_CHANGED],
NULL, NULL,
G_PARAM_READWRITE));
g_param_spec_object (gimp_context_prop_names[BUFFER_CHANGED],
NULL, NULL,
GIMP_TYPE_BUFFER,
G_PARAM_READWRITE));
}
static void
@ -699,13 +706,13 @@ gimp_context_set_property (GObject *object,
switch (property_id)
{
case PROP_IMAGE:
gimp_context_set_image (context, g_value_get_pointer (value));
gimp_context_set_image (context, g_value_get_object (value));
break;
case PROP_DISPLAY:
gimp_context_set_display (context, g_value_get_pointer (value));
break;
case PROP_TOOL:
gimp_context_set_tool (context, g_value_get_pointer (value));
gimp_context_set_tool (context, g_value_get_object (value));
break;
case PROP_FOREGROUND:
gimp_context_set_foreground (context, g_value_get_pointer (value));
@ -720,19 +727,19 @@ gimp_context_set_property (GObject *object,
gimp_context_set_paint_mode (context, g_value_get_int (value));
break;
case PROP_BRUSH:
gimp_context_set_brush (context, g_value_get_pointer (value));
gimp_context_set_brush (context, g_value_get_object (value));
break;
case PROP_PATTERN:
gimp_context_set_pattern (context, g_value_get_pointer (value));
gimp_context_set_pattern (context, g_value_get_object (value));
break;
case PROP_GRADIENT:
gimp_context_set_gradient (context, g_value_get_pointer (value));
gimp_context_set_gradient (context, g_value_get_object (value));
break;
case PROP_PALETTE:
gimp_context_set_palette (context, g_value_get_pointer (value));
gimp_context_set_palette (context, g_value_get_object (value));
break;
case PROP_BUFFER:
gimp_context_set_buffer (context, g_value_get_pointer (value));
gimp_context_set_buffer (context, g_value_get_object (value));
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
@ -753,13 +760,13 @@ gimp_context_get_property (GObject *object,
switch (property_id)
{
case PROP_IMAGE:
g_value_set_pointer (value, gimp_context_get_image (context));
g_value_set_object (value, gimp_context_get_image (context));
break;
case PROP_DISPLAY:
g_value_set_pointer (value, gimp_context_get_display (context));
break;
case PROP_TOOL:
g_value_set_pointer (value, gimp_context_get_tool (context));
g_value_set_object (value, gimp_context_get_tool (context));
break;
case PROP_FOREGROUND:
gimp_context_get_foreground (context, g_value_get_pointer (value));
@ -774,19 +781,19 @@ gimp_context_get_property (GObject *object,
g_value_set_int (value, gimp_context_get_paint_mode (context));
break;
case PROP_BRUSH:
g_value_set_pointer (value, gimp_context_get_brush (context));
g_value_set_object (value, gimp_context_get_brush (context));
break;
case PROP_PATTERN:
g_value_set_pointer (value, gimp_context_get_pattern (context));
g_value_set_object (value, gimp_context_get_pattern (context));
break;
case PROP_GRADIENT:
g_value_set_pointer (value, gimp_context_get_gradient (context));
g_value_set_object (value, gimp_context_get_gradient (context));
break;
case PROP_PALETTE:
g_value_set_pointer (value, gimp_context_get_palette (context));
g_value_set_object (value, gimp_context_get_palette (context));
break;
case PROP_BUFFER:
g_value_set_pointer (value, gimp_context_get_buffer (context));
g_value_set_object (value, gimp_context_get_buffer (context));
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);

View File

@ -215,9 +215,9 @@ resize_widget_new (ResizeType type,
NULL);
g_signal_connect_swapped (G_OBJECT (resize->resize_shell), "destroy",
G_CALLBACK (g_free),
private);
g_object_weak_ref (G_OBJECT (resize->resize_shell),
(GWeakNotify) g_free,
private);
}
/* handle the image disappearing under our feet */

View File

@ -360,9 +360,9 @@ channels_new_channel_query (GimpImage *gimage)
NULL);
g_signal_connect_swapped (G_OBJECT (options->query_box), "destroy",
G_CALLBACK (g_free),
options);
g_object_weak_ref (G_OBJECT (options->query_box),
(GWeakNotify) g_free,
options);
/* The main hbox */
hbox = gtk_hbox_new (FALSE, 2);
@ -513,9 +513,9 @@ channels_edit_channel_query (GimpChannel *channel)
NULL);
g_signal_connect_swapped (G_OBJECT (options->query_box), "destroy",
G_CALLBACK (g_free),
options);
g_object_weak_ref (G_OBJECT (options->query_box),
(GWeakNotify) g_free,
options);
g_signal_connect_object (G_OBJECT (channel), "removed",
G_CALLBACK (gtk_widget_destroy),

View File

@ -193,7 +193,7 @@ edit_named_cut_cmd_callback (GtkWidget *widget,
"dialogs/cut_named.html",
_("Enter a name for this buffer"),
NULL,
G_OBJECT (gdisp->gimage), "destroy",
G_OBJECT (gdisp->gimage), "disconnect",
cut_named_buffer_callback, gdisp->gimage);
gtk_widget_show (qbox);
}
@ -212,7 +212,7 @@ edit_named_copy_cmd_callback (GtkWidget *widget,
"dialogs/copy_named.html",
_("Enter a name for this buffer"),
NULL,
G_OBJECT (gdisp->gimage), "destroy",
G_OBJECT (gdisp->gimage), "disconnect",
copy_named_buffer_callback, gdisp->gimage);
gtk_widget_show (qbox);
}

View File

@ -234,7 +234,8 @@ file_revert_cmd_callback (GtkWidget *widget,
FALSE,
text,
GTK_STOCK_YES, GTK_STOCK_NO,
G_OBJECT (gdisp->gimage), "destroy",
G_OBJECT (gdisp->gimage),
"disconnect",
file_revert_confirm_callback,
gdisp->gimage);

View File

@ -83,7 +83,7 @@ static void gui_display_changed (GimpContext *context,
GDisplay *display,
gpointer data);
static void gui_image_destroy (GimpImage *gimage,
static void gui_image_disconnect (GimpImage *gimage,
gpointer data);
static void gui_image_mode_changed (GimpImage *gimage,
gpointer data);
@ -111,7 +111,7 @@ extern GSList *display_list; /* from gdisplay.c */
/* private variables */
static GQuark image_destroy_handler_id = 0;
static GQuark image_disconnect_handler_id = 0;
static GQuark image_mode_changed_handler_id = 0;
static GQuark image_colormap_changed_handler_id = 0;
static GQuark image_name_changed_handler_id = 0;
@ -213,9 +213,9 @@ gui_init (Gimp *gimp)
if (gimprc.always_restore_session)
restore_session = TRUE;
image_destroy_handler_id =
gimp_container_add_handler (gimp->images, "destroy",
G_CALLBACK (gui_image_destroy),
image_disconnect_handler_id =
gimp_container_add_handler (gimp->images, "disconnect",
G_CALLBACK (gui_image_disconnect),
gimp);
image_mode_changed_handler_id =
@ -358,7 +358,7 @@ gui_exit (Gimp *gimp)
gimp_help_free ();
gimp_container_remove_handler (gimp->images, image_destroy_handler_id);
gimp_container_remove_handler (gimp->images, image_disconnect_handler_id);
gimp_container_remove_handler (gimp->images, image_mode_changed_handler_id);
gimp_container_remove_handler (gimp->images, image_colormap_changed_handler_id);
gimp_container_remove_handler (gimp->images, image_name_changed_handler_id);
@ -366,7 +366,7 @@ gui_exit (Gimp *gimp)
gimp_container_remove_handler (gimp->images, image_alpha_changed_handler_id);
gimp_container_remove_handler (gimp->images, image_update_handler_id);
image_destroy_handler_id = 0;
image_disconnect_handler_id = 0;
image_mode_changed_handler_id = 0;
image_colormap_changed_handler_id = 0;
image_name_changed_handler_id = 0;
@ -536,8 +536,8 @@ gui_display_changed (GimpContext *context,
}
static void
gui_image_destroy (GimpImage *gimage,
gpointer data)
gui_image_disconnect (GimpImage *gimage,
gpointer data)
{
Gimp *gimp;

View File

@ -594,9 +594,9 @@ layers_new_layer_query (GimpImage *gimage)
NULL);
g_signal_connect_swapped (G_OBJECT (options->query_box), "destroy",
G_CALLBACK (g_free),
options);
g_object_weak_ref (G_OBJECT (options->query_box),
(GWeakNotify) g_free,
options);
/* The main vbox */
vbox = gtk_vbox_new (FALSE, 2);
@ -777,9 +777,9 @@ layers_edit_layer_query (GimpLayer *layer)
NULL);
g_signal_connect_swapped (G_OBJECT (options->query_box), "destroy",
G_CALLBACK (g_free),
options);
g_object_weak_ref (G_OBJECT (options->query_box),
(GWeakNotify) g_free,
options);
g_signal_connect_object (G_OBJECT (layer), "removed",
G_CALLBACK (gtk_widget_destroy),
@ -882,9 +882,9 @@ layers_add_mask_query (GimpLayer *layer)
NULL);
g_signal_connect_swapped (G_OBJECT (options->query_box), "destroy",
G_CALLBACK (g_free),
options);
g_object_weak_ref (G_OBJECT (options->query_box),
(GWeakNotify) g_free,
options);
g_signal_connect_object (G_OBJECT (layer), "removed",
G_CALLBACK (gtk_widget_destroy),
@ -1018,9 +1018,9 @@ layers_scale_layer_query (GimpImage *gimage,
NULL,
options);
g_signal_connect_swapped (G_OBJECT (options->resize->resize_shell), "destroy",
G_CALLBACK (g_free),
options);
g_object_weak_ref (G_OBJECT (options->resize->resize_shell),
(GWeakNotify) g_free,
options);
gtk_widget_show (options->resize->resize_shell);
}
@ -1106,9 +1106,9 @@ layers_resize_layer_query (GimpImage *gimage,
NULL,
options);
g_signal_connect_swapped (G_OBJECT (options->resize->resize_shell), "destroy",
G_CALLBACK (g_free),
options);
g_object_weak_ref (G_OBJECT (options->resize->resize_shell),
(GWeakNotify) g_free,
options);
gtk_widget_show (options->resize->resize_shell);
}
@ -1176,9 +1176,9 @@ layers_layer_merge_query (GimpImage *gimage,
NULL);
g_signal_connect_swapped (G_OBJECT (options->query_box), "destroy",
G_CALLBACK (g_free),
options);
g_object_weak_ref (G_OBJECT (options->query_box),
(GWeakNotify) g_free,
options);
/* The main vbox */
vbox = gtk_vbox_new (FALSE, 2);

View File

@ -215,9 +215,9 @@ resize_widget_new (ResizeType type,
NULL);
g_signal_connect_swapped (G_OBJECT (resize->resize_shell), "destroy",
G_CALLBACK (g_free),
private);
g_object_weak_ref (G_OBJECT (resize->resize_shell),
(GWeakNotify) g_free,
private);
}
/* handle the image disappearing under our feet */

View File

@ -131,7 +131,7 @@ select_feather_cmd_callback (GtkWidget *widget,
MIN (gdisp->gimage->xresolution,
gdisp->gimage->yresolution),
gdisp->dot_for_dot,
G_OBJECT (gdisp->gimage), "destroy",
G_OBJECT (gdisp->gimage), "disconnect",
gimage_mask_feather_callback, gdisp->gimage);
gtk_widget_show (qbox);
}
@ -167,7 +167,7 @@ select_shrink_cmd_callback (GtkWidget *widget,
MIN (gdisp->gimage->xresolution,
gdisp->gimage->yresolution),
gdisp->dot_for_dot,
G_OBJECT (gdisp->gimage), "destroy",
G_OBJECT (gdisp->gimage), "disconnect",
gimage_mask_shrink_callback, gdisp->gimage);
edge_lock = gtk_check_button_new_with_label (_("Shrink from image border"));
@ -201,7 +201,7 @@ select_grow_cmd_callback (GtkWidget *widget,
MIN (gdisp->gimage->xresolution,
gdisp->gimage->yresolution),
gdisp->dot_for_dot,
G_OBJECT (gdisp->gimage), "destroy",
G_OBJECT (gdisp->gimage), "disconnect",
gimage_mask_grow_callback, gdisp->gimage);
gtk_widget_show (qbox);
}
@ -224,7 +224,7 @@ select_border_cmd_callback (GtkWidget *widget,
MIN (gdisp->gimage->xresolution,
gdisp->gimage->yresolution),
gdisp->dot_for_dot,
G_OBJECT (gdisp->gimage), "destroy",
G_OBJECT (gdisp->gimage), "disconnect",
gimage_mask_border_callback, gdisp->gimage);
gtk_widget_show (qbox);
}

View File

@ -236,8 +236,8 @@ gimp_clone_tool_init (GimpCloneTool *clone)
}
static void
clone_src_drawable_destroyed_cb (GimpDrawable *drawable,
GimpDrawable **src_drawable)
clone_src_drawable_disconnect_cb (GimpDrawable *drawable,
GimpDrawable **src_drawable)
{
if (drawable == *src_drawable)
{
@ -254,14 +254,14 @@ clone_set_src_drawable (GimpDrawable *drawable)
if (src_drawable_)
g_signal_handlers_disconnect_by_func (G_OBJECT (src_drawable_),
G_CALLBACK (clone_src_drawable_destroyed_cb),
G_CALLBACK (clone_src_drawable_disconnect_cb),
&src_drawable_);
src_drawable_ = drawable;
if (drawable)
{
g_signal_connect (G_OBJECT (drawable), "destroy",
G_CALLBACK (clone_src_drawable_destroyed_cb),
g_signal_connect (G_OBJECT (drawable), "disconnect",
G_CALLBACK (clone_src_drawable_disconnect_cb),
&src_drawable_);
}
}

View File

@ -236,8 +236,8 @@ gimp_clone_tool_init (GimpCloneTool *clone)
}
static void
clone_src_drawable_destroyed_cb (GimpDrawable *drawable,
GimpDrawable **src_drawable)
clone_src_drawable_disconnect_cb (GimpDrawable *drawable,
GimpDrawable **src_drawable)
{
if (drawable == *src_drawable)
{
@ -254,14 +254,14 @@ clone_set_src_drawable (GimpDrawable *drawable)
if (src_drawable_)
g_signal_handlers_disconnect_by_func (G_OBJECT (src_drawable_),
G_CALLBACK (clone_src_drawable_destroyed_cb),
G_CALLBACK (clone_src_drawable_disconnect_cb),
&src_drawable_);
src_drawable_ = drawable;
if (drawable)
{
g_signal_connect (G_OBJECT (drawable), "destroy",
G_CALLBACK (clone_src_drawable_destroyed_cb),
g_signal_connect (G_OBJECT (drawable), "disconnect",
G_CALLBACK (clone_src_drawable_disconnect_cb),
&src_drawable_);
}
}

View File

@ -236,8 +236,8 @@ gimp_clone_tool_init (GimpCloneTool *clone)
}
static void
clone_src_drawable_destroyed_cb (GimpDrawable *drawable,
GimpDrawable **src_drawable)
clone_src_drawable_disconnect_cb (GimpDrawable *drawable,
GimpDrawable **src_drawable)
{
if (drawable == *src_drawable)
{
@ -254,14 +254,14 @@ clone_set_src_drawable (GimpDrawable *drawable)
if (src_drawable_)
g_signal_handlers_disconnect_by_func (G_OBJECT (src_drawable_),
G_CALLBACK (clone_src_drawable_destroyed_cb),
G_CALLBACK (clone_src_drawable_disconnect_cb),
&src_drawable_);
src_drawable_ = drawable;
if (drawable)
{
g_signal_connect (G_OBJECT (drawable), "destroy",
G_CALLBACK (clone_src_drawable_destroyed_cb),
g_signal_connect (G_OBJECT (drawable), "disconnect",
G_CALLBACK (clone_src_drawable_disconnect_cb),
&src_drawable_);
}
}

View File

@ -236,8 +236,8 @@ gimp_clone_tool_init (GimpCloneTool *clone)
}
static void
clone_src_drawable_destroyed_cb (GimpDrawable *drawable,
GimpDrawable **src_drawable)
clone_src_drawable_disconnect_cb (GimpDrawable *drawable,
GimpDrawable **src_drawable)
{
if (drawable == *src_drawable)
{
@ -254,14 +254,14 @@ clone_set_src_drawable (GimpDrawable *drawable)
if (src_drawable_)
g_signal_handlers_disconnect_by_func (G_OBJECT (src_drawable_),
G_CALLBACK (clone_src_drawable_destroyed_cb),
G_CALLBACK (clone_src_drawable_disconnect_cb),
&src_drawable_);
src_drawable_ = drawable;
if (drawable)
{
g_signal_connect (G_OBJECT (drawable), "destroy",
G_CALLBACK (clone_src_drawable_destroyed_cb),
g_signal_connect (G_OBJECT (drawable), "disconnect",
G_CALLBACK (clone_src_drawable_disconnect_cb),
&src_drawable_);
}
}

View File

@ -424,7 +424,7 @@ gimp_data_factory_view_delete_clicked (GtkWidget *widget,
str,
GIMP_STOCK_DELETE, GTK_STOCK_CANCEL,
G_OBJECT (data),
"destroy",
"disconnect",
gimp_data_factory_view_delete_callback,
delete_data);

View File

@ -407,9 +407,9 @@ gimp_preview_set_viewable (GimpPreview *preview,
NULL);
}
g_signal_connect (G_OBJECT (preview->viewable), "destroy",
G_CALLBACK (gtk_widget_destroyed),
&preview->viewable);
g_object_weak_ref (G_OBJECT (preview->viewable),
(GWeakNotify) gtk_widget_destroyed,
&preview->viewable);
g_signal_connect_swapped (G_OBJECT (preview->viewable),
"invalidate_preview",

View File

@ -407,9 +407,9 @@ gimp_preview_set_viewable (GimpPreview *preview,
NULL);
}
g_signal_connect (G_OBJECT (preview->viewable), "destroy",
G_CALLBACK (gtk_widget_destroyed),
&preview->viewable);
g_object_weak_ref (G_OBJECT (preview->viewable),
(GWeakNotify) gtk_widget_destroyed,
&preview->viewable);
g_signal_connect_swapped (G_OBJECT (preview->viewable),
"invalidate_preview",

View File

@ -407,9 +407,9 @@ gimp_preview_set_viewable (GimpPreview *preview,
NULL);
}
g_signal_connect (G_OBJECT (preview->viewable), "destroy",
G_CALLBACK (gtk_widget_destroyed),
&preview->viewable);
g_object_weak_ref (G_OBJECT (preview->viewable),
(GWeakNotify) gtk_widget_destroyed,
&preview->viewable);
g_signal_connect_swapped (G_OBJECT (preview->viewable),
"invalidate_preview",

View File

@ -407,9 +407,9 @@ gimp_preview_set_viewable (GimpPreview *preview,
NULL);
}
g_signal_connect (G_OBJECT (preview->viewable), "destroy",
G_CALLBACK (gtk_widget_destroyed),
&preview->viewable);
g_object_weak_ref (G_OBJECT (preview->viewable),
(GWeakNotify) gtk_widget_destroyed,
&preview->viewable);
g_signal_connect_swapped (G_OBJECT (preview->viewable),
"invalidate_preview",