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> 2004-10-09 DindinX <dindinx@gimp.org>
* app/dialogs/dialogs.h: fixed a typo in the double-inclusion guard. * 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; GimpContainerViewPrivate *private;
g_return_val_if_fail (GIMP_IS_CONTAINER_VIEW (view), NULL); 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); 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; GimpThumbnail *thumb = box->imagefile->thumbnail;
const gchar *uri = gimp_object_get_name (GIMP_OBJECT (box->imagefile)); 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) switch (thumb->thumb_state)
{ {
@ -701,10 +701,14 @@ gimp_thumb_box_auto_thumbnail (GimpThumbBox *box)
/* This is tricky because gimp_imagefile_create_thumbnail() /* This is tricky because gimp_imagefile_create_thumbnail()
* may call a plug-in and the progress callback runs the * may call a plug-in and the progress callback runs the
* mainloop. Thus the dialog may change below our feet. For * 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. * thumbnail.
*/ */
GimpImagefile *local = gimp_imagefile_new (gimp, uri); 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) if (thumb->image_filesize > 0)
{ {
@ -731,13 +735,18 @@ gimp_thumb_box_auto_thumbnail (GimpThumbBox *box)
GIMP_PROGRESS (box), GIMP_PROGRESS (box),
gimp->config->thumbnail_size); gimp->config->thumbnail_size);
if (box) if (imagefile)
{ {
if (strcmp (gimp_object_get_name (GIMP_OBJECT (box->imagefile)), uri = gimp_object_get_name (GIMP_OBJECT (imagefile));
gimp_object_get_name (GIMP_OBJECT (local))) == 0)
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); g_object_unref (local);
@ -748,12 +757,5 @@ gimp_thumb_box_auto_thumbnail (GimpThumbBox *box)
break; break;
} }
if (box)
{
g_object_remove_weak_pointer (G_OBJECT (box), (gpointer) &box);
box->idle_id = 0;
}
return FALSE; return FALSE;
} }

View File

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

View File

@ -222,19 +222,15 @@ xcf_load_invoker (Gimp *gimp,
GimpProgress *progress, GimpProgress *progress,
Argument *args) Argument *args)
{ {
XcfInfo info; XcfInfo info;
Argument *return_args; Argument *return_args;
GimpImage *gimage; GimpImage *gimage = NULL;
gchar *filename; const gchar *filename;
gboolean success; gboolean success = FALSE;
gchar id[14]; gchar id[14];
gimp_set_busy (gimp); gimp_set_busy (gimp);
gimage = NULL;
success = FALSE;
filename = args[1].value.pdb_pointer; filename = args[1].value.pdb_pointer;
info.fp = fopen (filename, "rb"); info.fp = fopen (filename, "rb");
@ -314,16 +310,14 @@ xcf_save_invoker (Gimp *gimp,
GimpProgress *progress, GimpProgress *progress,
Argument *args) Argument *args)
{ {
XcfInfo info; XcfInfo info;
Argument *return_args; Argument *return_args;
GimpImage *gimage; GimpImage *gimage;
gchar *filename; const gchar *filename;
gboolean success; gboolean success = FALSE;
gimp_set_busy (gimp); gimp_set_busy (gimp);
success = FALSE;
gimage = gimp_image_get_by_ID (gimp, args[1].value.pdb_int); gimage = gimp_image_get_by_ID (gimp, args[1].value.pdb_int);
filename = args[3].value.pdb_pointer; filename = args[3].value.pdb_pointer;