only create the temporary file if there is a parasite to load.

2005-06-06  Sven Neumann  <sven@gimp.org>

	* plug-ins/gfig/gfig.c (gfig_load_from_parasite): only create the
	temporary file if there is a parasite to load.
This commit is contained in:
Sven Neumann 2005-06-06 15:43:57 +00:00 committed by Sven Neumann
parent 365f79262b
commit b29fc29b2e
2 changed files with 16 additions and 8 deletions

View File

@ -1,3 +1,8 @@
2005-06-06 Sven Neumann <sven@gimp.org>
* plug-ins/gfig/gfig.c (gfig_load_from_parasite): only create the
temporary file if there is a parasite to load.
2005-06-06 Sven Neumann <sven@gimp.org>
* app/widgets/gimpcellrendererdashes.c: removed unused variable.

View File

@ -741,7 +741,12 @@ gfig_load_from_parasite (void)
GimpParasite *parasite;
GFigObj *gfig;
parasite = gimp_drawable_parasite_find (gfig_context->drawable_id, "gfig");
if (! parasite)
return NULL;
fname = gimp_temp_name ("gfigtmp");
fp = g_fopen (fname, "w");
if (!fp)
{
@ -751,23 +756,21 @@ gfig_load_from_parasite (void)
return NULL;
}
parasite = gimp_drawable_parasite_find (gfig_context->drawable_id, "gfig");
if (!parasite)
return NULL;
fwrite (gimp_parasite_data (parasite),
sizeof (guchar),
gimp_parasite_data_size (parasite),
fp);
gimp_parasite_free (parasite);
fclose (fp);
gimp_parasite_free (parasite);
gfig = gfig_load (fname, "(none)");
g_unlink (fname);
return (gfig);
g_free (fname);
return gfig;
}
void