Commit ebe7d2f9 authored by Sven Neumann's avatar Sven Neumann Committed by Sven Neumann
Browse files

app/channel.c use gtk_object_sink() instead of gtk_object_unref() when

2000-12-28  Sven Neumann  <sven@gimp.org>

	* app/channel.c
	* app/layer.c: use gtk_object_sink() instead of gtk_object_unref()
	when deleting a layer or channel since only floating objects should
	be destroyed this way. A layer or channel that has been attached
	to an image shall never be deleted.

	* app/layer_cmds.c
	* libgimp/gimplayer_pdb.c
	* tools/pdbgen/pdb/layer.pdb: reenabled the gimp_layer_delete() PDB
	function since it might be useful under rare circumstances.
parent 4e5c3195
2000-12-28 Sven Neumann <sven@gimp.org>
* app/channel.c
* app/layer.c: use gtk_object_sink() instead of gtk_object_unref()
when deleting a layer or channel since only floating objects should
be destroyed this way. A layer or channel that has been attached
to an image shall never be deleted.
* app/layer_cmds.c
* libgimp/gimplayer_pdb.c
* tools/pdbgen/pdb/layer.pdb: reenabled the gimp_layer_delete() PDB
function since it might be useful under rare circumstances.
2000-12-28 Sven Neumann <sven@gimp.org>
* app/commands.c
......
......@@ -280,7 +280,12 @@ channel_get_ID (gint ID)
void
channel_delete (Channel *channel)
{
gtk_object_unref (GTK_OBJECT (channel));
/* Channels are normally deleted by removing them from the associated
image. The only case where channel_delete() is useful is if you want
to remove a floating channel object that has not been added to an
image yet. We use gtk_object_sink() for this reason here.
*/
gtk_object_sink (GTK_OBJECT (channel));
}
static void
......
......@@ -280,7 +280,12 @@ channel_get_ID (gint ID)
void
channel_delete (Channel *channel)
{
gtk_object_unref (GTK_OBJECT (channel));
/* Channels are normally deleted by removing them from the associated
image. The only case where channel_delete() is useful is if you want
to remove a floating channel object that has not been added to an
image yet. We use gtk_object_sink() for this reason here.
*/
gtk_object_sink (GTK_OBJECT (channel));
}
static void
......
......@@ -280,7 +280,12 @@ channel_get_ID (gint ID)
void
channel_delete (Channel *channel)
{
gtk_object_unref (GTK_OBJECT (channel));
/* Channels are normally deleted by removing them from the associated
image. The only case where channel_delete() is useful is if you want
to remove a floating channel object that has not been added to an
image yet. We use gtk_object_sink() for this reason here.
*/
gtk_object_sink (GTK_OBJECT (channel));
}
static void
......
......@@ -573,7 +573,12 @@ layer_get_ID (gint ID)
void
layer_delete (Layer *layer)
{
gtk_object_unref (GTK_OBJECT (layer));
/* Layers are normally deleted by removing them from the associated
image. The only case where layer_delete() is useful is if you want
to remove a floating layer object that has not been added to an
image yet. We use gtk_object_sink() for this reason here.
*/
gtk_object_sink (GTK_OBJECT (layer));
}
static void
......
......@@ -280,7 +280,12 @@ channel_get_ID (gint ID)
void
channel_delete (Channel *channel)
{
gtk_object_unref (GTK_OBJECT (channel));
/* Channels are normally deleted by removing them from the associated
image. The only case where channel_delete() is useful is if you want
to remove a floating channel object that has not been added to an
image yet. We use gtk_object_sink() for this reason here.
*/
gtk_object_sink (GTK_OBJECT (channel));
}
static void
......
......@@ -573,7 +573,12 @@ layer_get_ID (gint ID)
void
layer_delete (Layer *layer)
{
gtk_object_unref (GTK_OBJECT (layer));
/* Layers are normally deleted by removing them from the associated
image. The only case where layer_delete() is useful is if you want
to remove a floating layer object that has not been added to an
image yet. We use gtk_object_sink() for this reason here.
*/
gtk_object_sink (GTK_OBJECT (layer));
}
static void
......
......@@ -573,7 +573,12 @@ layer_get_ID (gint ID)
void
layer_delete (Layer *layer)
{
gtk_object_unref (GTK_OBJECT (layer));
/* Layers are normally deleted by removing them from the associated
image. The only case where layer_delete() is useful is if you want
to remove a floating layer object that has not been added to an
image yet. We use gtk_object_sink() for this reason here.
*/
gtk_object_sink (GTK_OBJECT (layer));
}
static void
......
......@@ -546,6 +546,9 @@ layer_delete_invoker (Argument *args)
if (layer == NULL)
success = FALSE;
if (success)
layer_delete (layer);
return procedural_db_return_args (&layer_delete_proc, success);
}
......@@ -562,7 +565,7 @@ static ProcRecord layer_delete_proc =
{
"gimp_layer_delete",
"Delete a layer.",
"This procedure is obsolete and does nothing. Layers are automatically deleted when removed from an image or if the associated image is destroyed.",
"This procedure deletes the specified layer. This must not be done if the gimage containing this layer was already deleted or if the layer was already removed from the image. The only case in which this procedure is useful is if you want to get rid of a layer which has not yet been added to an image.",
"Spencer Kimball & Peter Mattis",
"Spencer Kimball & Peter Mattis",
"1995-1996",
......
......@@ -247,9 +247,11 @@ gimp_layer_resize (gint32 layer_ID,
*
* Delete a layer.
*
* This procedure is obsolete and does nothing. Layers are
* automatically deleted when removed from an image or if the
* associated image is destroyed.
* This procedure deletes the specified layer. This must not be done if
* the gimage containing this layer was already deleted or if the layer
* was already removed from the image. The only case in which this
* procedure is useful is if you want to get rid of a layer which has
* not yet been added to an image.
*
* Returns: TRUE on success.
*/
......
......@@ -338,8 +338,11 @@ sub layer_delete {
$blurb = 'Delete a layer.';
$help = <<'HELP';
This procedure is obsolete and does nothing. Layers are automatically deleted
when removed from an image or if the associated image is destroyed.
This procedure deletes the specified layer. This must not be done if the
gimage containing this layer was already deleted or if the layer was
already removed from the image. The only case in which this procedure is
useful is if you want to get rid of a layer which has not yet been
added to an image.
HELP
&std_pdb_misc;
......@@ -347,7 +350,7 @@ HELP
@inargs = ( &layer_arg );
$inargs[0]->{desc} .= ' to delete';
%invoke = ();
%invoke = ( code => 'layer_delete (layer);' );
}
sub layer_translate {
......
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