Commit 5e4e7d88 authored by Sven Neumann's avatar Sven Neumann
Browse files

Fixed a crash that oxccured when gimp_export_image() was called with an

active floating selection.
gimp_image_merge_visible_layers() and gimp_image_flatten() did not handle
floating selections.


--Sven
parent 908a076a
Wed Jan 5 11:35:10 CET 2000 Sven Neumann <sven@gimp.org>
* app/gimpimage.c: In gimp_image_merge_visible_layers and
gimp_image_flatten handle a floating selection by anchoring it.
This functions can't be called from the UI if a floating selection
exists, but you can call them via the PDB. This is why
gimp_export_image used to crash when called with a floating_sel.
Tue Jan 4 17:19:22 EST 2000 Adrian Likins <adrian@gimp.org>
 
* PLUGIN_MAINTAINERS: I claim mail.c as mine
......
......@@ -2282,8 +2282,16 @@ gimp_image_merge_visible_layers (GimpImage *gimage,
{
GSList *layer_list;
GSList *merge_list = NULL;
gboolean had_floating_sel = FALSE;
Layer *layer;
/* if there's a floating selection, anchor it */
if (gimp_image_floating_sel (gimage))
{
floating_sel_anchor (gimage->floating_sel);
had_floating_sel = TRUE;
}
layer_list = gimage->layers;
while (layer_list)
{
......@@ -2304,8 +2312,15 @@ gimp_image_merge_visible_layers (GimpImage *gimage,
}
else
{
g_message (_("There are not enough visible layers for a merge.\nThere must be at least two."));
g_slist_free (merge_list);
/* If there was a floating selection, we have done something.
No need to warn the user. Return the active layer instead */
if (had_floating_sel)
return layer;
else
g_message (_("There are not enough visible layers for a merge.\nThere must be at least two."));
return NULL;
}
}
......@@ -2319,6 +2334,10 @@ gimp_image_flatten (GimpImage *gimage)
gimp_add_busy_cursors ();
/* if there's a floating selection, anchor it */
if (gimp_image_floating_sel (gimage))
floating_sel_anchor (gimage->floating_sel);
layer_list = gimage->layers;
while (layer_list)
{
......
......@@ -2282,8 +2282,16 @@ gimp_image_merge_visible_layers (GimpImage *gimage,
{
GSList *layer_list;
GSList *merge_list = NULL;
gboolean had_floating_sel = FALSE;
Layer *layer;
/* if there's a floating selection, anchor it */
if (gimp_image_floating_sel (gimage))
{
floating_sel_anchor (gimage->floating_sel);
had_floating_sel = TRUE;
}
layer_list = gimage->layers;
while (layer_list)
{
......@@ -2304,8 +2312,15 @@ gimp_image_merge_visible_layers (GimpImage *gimage,
}
else
{
g_message (_("There are not enough visible layers for a merge.\nThere must be at least two."));
g_slist_free (merge_list);
/* If there was a floating selection, we have done something.
No need to warn the user. Return the active layer instead */
if (had_floating_sel)
return layer;
else
g_message (_("There are not enough visible layers for a merge.\nThere must be at least two."));
return NULL;
}
}
......@@ -2319,6 +2334,10 @@ gimp_image_flatten (GimpImage *gimage)
gimp_add_busy_cursors ();
/* if there's a floating selection, anchor it */
if (gimp_image_floating_sel (gimage))
floating_sel_anchor (gimage->floating_sel);
layer_list = gimage->layers;
while (layer_list)
{
......
......@@ -2282,8 +2282,16 @@ gimp_image_merge_visible_layers (GimpImage *gimage,
{
GSList *layer_list;
GSList *merge_list = NULL;
gboolean had_floating_sel = FALSE;
Layer *layer;
/* if there's a floating selection, anchor it */
if (gimp_image_floating_sel (gimage))
{
floating_sel_anchor (gimage->floating_sel);
had_floating_sel = TRUE;
}
layer_list = gimage->layers;
while (layer_list)
{
......@@ -2304,8 +2312,15 @@ gimp_image_merge_visible_layers (GimpImage *gimage,
}
else
{
g_message (_("There are not enough visible layers for a merge.\nThere must be at least two."));
g_slist_free (merge_list);
/* If there was a floating selection, we have done something.
No need to warn the user. Return the active layer instead */
if (had_floating_sel)
return layer;
else
g_message (_("There are not enough visible layers for a merge.\nThere must be at least two."));
return NULL;
}
}
......@@ -2319,6 +2334,10 @@ gimp_image_flatten (GimpImage *gimage)
gimp_add_busy_cursors ();
/* if there's a floating selection, anchor it */
if (gimp_image_floating_sel (gimage))
floating_sel_anchor (gimage->floating_sel);
layer_list = gimage->layers;
while (layer_list)
{
......
......@@ -2282,8 +2282,16 @@ gimp_image_merge_visible_layers (GimpImage *gimage,
{
GSList *layer_list;
GSList *merge_list = NULL;
gboolean had_floating_sel = FALSE;
Layer *layer;
/* if there's a floating selection, anchor it */
if (gimp_image_floating_sel (gimage))
{
floating_sel_anchor (gimage->floating_sel);
had_floating_sel = TRUE;
}
layer_list = gimage->layers;
while (layer_list)
{
......@@ -2304,8 +2312,15 @@ gimp_image_merge_visible_layers (GimpImage *gimage,
}
else
{
g_message (_("There are not enough visible layers for a merge.\nThere must be at least two."));
g_slist_free (merge_list);
/* If there was a floating selection, we have done something.
No need to warn the user. Return the active layer instead */
if (had_floating_sel)
return layer;
else
g_message (_("There are not enough visible layers for a merge.\nThere must be at least two."));
return NULL;
}
}
......@@ -2319,6 +2334,10 @@ gimp_image_flatten (GimpImage *gimage)
gimp_add_busy_cursors ();
/* if there's a floating selection, anchor it */
if (gimp_image_floating_sel (gimage))
floating_sel_anchor (gimage->floating_sel);
layer_list = gimage->layers;
while (layer_list)
{
......
......@@ -2282,8 +2282,16 @@ gimp_image_merge_visible_layers (GimpImage *gimage,
{
GSList *layer_list;
GSList *merge_list = NULL;
gboolean had_floating_sel = FALSE;
Layer *layer;
/* if there's a floating selection, anchor it */
if (gimp_image_floating_sel (gimage))
{
floating_sel_anchor (gimage->floating_sel);
had_floating_sel = TRUE;
}
layer_list = gimage->layers;
while (layer_list)
{
......@@ -2304,8 +2312,15 @@ gimp_image_merge_visible_layers (GimpImage *gimage,
}
else
{
g_message (_("There are not enough visible layers for a merge.\nThere must be at least two."));
g_slist_free (merge_list);
/* If there was a floating selection, we have done something.
No need to warn the user. Return the active layer instead */
if (had_floating_sel)
return layer;
else
g_message (_("There are not enough visible layers for a merge.\nThere must be at least two."));
return NULL;
}
}
......@@ -2319,6 +2334,10 @@ gimp_image_flatten (GimpImage *gimage)
gimp_add_busy_cursors ();
/* if there's a floating selection, anchor it */
if (gimp_image_floating_sel (gimage))
floating_sel_anchor (gimage->floating_sel);
layer_list = gimage->layers;
while (layer_list)
{
......
......@@ -2282,8 +2282,16 @@ gimp_image_merge_visible_layers (GimpImage *gimage,
{
GSList *layer_list;
GSList *merge_list = NULL;
gboolean had_floating_sel = FALSE;
Layer *layer;
/* if there's a floating selection, anchor it */
if (gimp_image_floating_sel (gimage))
{
floating_sel_anchor (gimage->floating_sel);
had_floating_sel = TRUE;
}
layer_list = gimage->layers;
while (layer_list)
{
......@@ -2304,8 +2312,15 @@ gimp_image_merge_visible_layers (GimpImage *gimage,
}
else
{
g_message (_("There are not enough visible layers for a merge.\nThere must be at least two."));
g_slist_free (merge_list);
/* If there was a floating selection, we have done something.
No need to warn the user. Return the active layer instead */
if (had_floating_sel)
return layer;
else
g_message (_("There are not enough visible layers for a merge.\nThere must be at least two."));
return NULL;
}
}
......@@ -2319,6 +2334,10 @@ gimp_image_flatten (GimpImage *gimage)
gimp_add_busy_cursors ();
/* if there's a floating selection, anchor it */
if (gimp_image_floating_sel (gimage))
floating_sel_anchor (gimage->floating_sel);
layer_list = gimage->layers;
while (layer_list)
{
......
......@@ -2282,8 +2282,16 @@ gimp_image_merge_visible_layers (GimpImage *gimage,
{
GSList *layer_list;
GSList *merge_list = NULL;
gboolean had_floating_sel = FALSE;
Layer *layer;
/* if there's a floating selection, anchor it */
if (gimp_image_floating_sel (gimage))
{
floating_sel_anchor (gimage->floating_sel);
had_floating_sel = TRUE;
}
layer_list = gimage->layers;
while (layer_list)
{
......@@ -2304,8 +2312,15 @@ gimp_image_merge_visible_layers (GimpImage *gimage,
}
else
{
g_message (_("There are not enough visible layers for a merge.\nThere must be at least two."));
g_slist_free (merge_list);
/* If there was a floating selection, we have done something.
No need to warn the user. Return the active layer instead */
if (had_floating_sel)
return layer;
else
g_message (_("There are not enough visible layers for a merge.\nThere must be at least two."));
return NULL;
}
}
......@@ -2319,6 +2334,10 @@ gimp_image_flatten (GimpImage *gimage)
gimp_add_busy_cursors ();
/* if there's a floating selection, anchor it */
if (gimp_image_floating_sel (gimage))
floating_sel_anchor (gimage->floating_sel);
layer_list = gimage->layers;
while (layer_list)
{
......
......@@ -2282,8 +2282,16 @@ gimp_image_merge_visible_layers (GimpImage *gimage,
{
GSList *layer_list;
GSList *merge_list = NULL;
gboolean had_floating_sel = FALSE;
Layer *layer;
/* if there's a floating selection, anchor it */
if (gimp_image_floating_sel (gimage))
{
floating_sel_anchor (gimage->floating_sel);
had_floating_sel = TRUE;
}
layer_list = gimage->layers;
while (layer_list)
{
......@@ -2304,8 +2312,15 @@ gimp_image_merge_visible_layers (GimpImage *gimage,
}
else
{
g_message (_("There are not enough visible layers for a merge.\nThere must be at least two."));
g_slist_free (merge_list);
/* If there was a floating selection, we have done something.
No need to warn the user. Return the active layer instead */
if (had_floating_sel)
return layer;
else
g_message (_("There are not enough visible layers for a merge.\nThere must be at least two."));
return NULL;
}
}
......@@ -2319,6 +2334,10 @@ gimp_image_flatten (GimpImage *gimage)
gimp_add_busy_cursors ();
/* if there's a floating selection, anchor it */
if (gimp_image_floating_sel (gimage))
floating_sel_anchor (gimage->floating_sel);
layer_list = gimage->layers;
while (layer_list)
{
......
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