handle NULL as viewable parameter as a workaround for bug #149906.

2004-10-10  Sven Neumann  <sven@gimp.org>

	* app/widgets/gimpcontainerview.c (gimp_container_view_lookup):
	handle NULL as viewable parameter as a workaround for bug #149906.

	* app/widgets/gimpthumbbox.c (gimp_thumb_box_auto_thumbnail): made
	the code more robust.

	* app/xcf/xcf-private.h
	* app/xcf/xcf.c: added a const qualifier.
This commit is contained in:
Sven Neumann 2004-10-10 14:33:01 +00:00 committed by Sven Neumann
parent 450dc157ab
commit bfeb12d2bb
5 changed files with 44 additions and 33 deletions

View File

@ -1,3 +1,14 @@
2004-10-10 Sven Neumann <sven@gimp.org>
* app/widgets/gimpcontainerview.c (gimp_container_view_lookup):
handle NULL as viewable parameter as a workaround for bug #149906.
* app/widgets/gimpthumbbox.c (gimp_thumb_box_auto_thumbnail): made
the code more robust.
* app/xcf/xcf-private.h
* app/xcf/xcf.c: added a const qualifier.
2004-10-09 DindinX <dindinx@gimp.org>
* app/dialogs/dialogs.h: fixed a typo in the double-inclusion guard.

View File

@ -694,7 +694,11 @@ gimp_container_view_lookup (GimpContainerView *view,
GimpContainerViewPrivate *private;
g_return_val_if_fail (GIMP_IS_CONTAINER_VIEW (view), NULL);
g_return_val_if_fail (GIMP_IS_VIEWABLE (viewable), NULL);
g_return_val_if_fail (viewable == NULL || GIMP_IS_VIEWABLE (viewable), NULL);
/* we handle the NULL viewable here as a workaround for bug #149906 */
if (! viewable)
return NULL;
private = GIMP_CONTAINER_VIEW_GET_PRIVATE (view);

View File

@ -689,7 +689,7 @@ gimp_thumb_box_auto_thumbnail (GimpThumbBox *box)
GimpThumbnail *thumb = box->imagefile->thumbnail;
const gchar *uri = gimp_object_get_name (GIMP_OBJECT (box->imagefile));
g_object_add_weak_pointer (G_OBJECT (box), (gpointer) &box);
box->idle_id = 0;
switch (thumb->thumb_state)
{
@ -701,11 +701,15 @@ gimp_thumb_box_auto_thumbnail (GimpThumbBox *box)
/* This is tricky because gimp_imagefile_create_thumbnail()
* may call a plug-in and the progress callback runs the
* mainloop. Thus the dialog may change below our feet. For
* that reason we use a seperate GimpImagefile to create the
* that reason we use a separate GimpImagefile to create the
* thumbnail.
*/
GimpImagefile *imagefile = box->imagefile;
GimpImagefile *local = gimp_imagefile_new (gimp, uri);
g_object_add_weak_pointer (G_OBJECT (imagefile),
(gpointer) &imagefile);
if (thumb->image_filesize > 0)
{
gchar *size;
@ -731,13 +735,18 @@ gimp_thumb_box_auto_thumbnail (GimpThumbBox *box)
GIMP_PROGRESS (box),
gimp->config->thumbnail_size);
if (box)
if (imagefile)
{
if (strcmp (gimp_object_get_name (GIMP_OBJECT (box->imagefile)),
gimp_object_get_name (GIMP_OBJECT (local))) == 0)
uri = gimp_object_get_name (GIMP_OBJECT (imagefile));
if (uri &&
strcmp (uri, gimp_object_get_name (GIMP_OBJECT (local))) == 0)
{
gimp_imagefile_update (box->imagefile);
gimp_imagefile_update (imagefile);
}
g_object_remove_weak_pointer (G_OBJECT (imagefile),
(gpointer) &imagefile);
}
g_object_unref (local);
@ -748,12 +757,5 @@ gimp_thumb_box_auto_thumbnail (GimpThumbBox *box)
break;
}
if (box)
{
g_object_remove_weak_pointer (G_OBJECT (box), (gpointer) &box);
box->idle_id = 0;
}
return FALSE;
}

View File

@ -77,7 +77,7 @@ struct _XcfInfo
{
FILE *fp;
guint cp;
gchar *filename;
const gchar *filename;
GimpTattoo tattoo_state;
GimpLayer *active_layer;
GimpChannel *active_channel;

View File

@ -224,17 +224,13 @@ xcf_load_invoker (Gimp *gimp,
{
XcfInfo info;
Argument *return_args;
GimpImage *gimage;
gchar *filename;
gboolean success;
GimpImage *gimage = NULL;
const gchar *filename;
gboolean success = FALSE;
gchar id[14];
gimp_set_busy (gimp);
gimage = NULL;
success = FALSE;
filename = args[1].value.pdb_pointer;
info.fp = fopen (filename, "rb");
@ -317,13 +313,11 @@ xcf_save_invoker (Gimp *gimp,
XcfInfo info;
Argument *return_args;
GimpImage *gimage;
gchar *filename;
gboolean success;
const gchar *filename;
gboolean success = FALSE;
gimp_set_busy (gimp);
success = FALSE;
gimage = gimp_image_get_by_ID (gimp, args[1].value.pdb_int);
filename = args[3].value.pdb_pointer;