app: when opening an image, don't unref it if no display could be created

we normally do this because the initial display takes ownership of the
newly created image, but in no-interface mode we would simply unref
the image away, which is bad.
This commit is contained in:
Michael Natterer
2011-05-17 14:55:57 +02:00
parent cebd34293c
commit a75a9d9469

View File

@ -423,7 +423,11 @@ file_open_with_proc_and_display (Gimp *gimp,
g_free (basename);
}
gimp_create_display (image->gimp, image, GIMP_UNIT_PIXEL, 1.0);
if (gimp_create_display (image->gimp, image, GIMP_UNIT_PIXEL, 1.0))
{
/* the display owns the image now */
g_object_unref (image);
}
if (! as_new)
{
@ -445,9 +449,6 @@ file_open_with_proc_and_display (Gimp *gimp,
}
}
/* the display owns the image now */
g_object_unref (image);
/* announce that we opened this image */
gimp_image_opened (image->gimp, uri);
}