: free all the pipe's brushes here.

2001-04-25  Michael Natterer  <mitch@gimp.org>

	* app/gimpobject.c: : free all the pipe's brushes here.

	* app/gimpparasite.c: gimp_personal_rc_file()'s return value has
	to be g_free()'d.

	* app/main.c: indentation.

	Ported memleak fixes from 1.2:

	* app/gimpbrush.c: don't leak all pixmaps.

	* app/gimpbrushpipe.c: ported memleak fixes from 1.2
This commit is contained in:
Michael Natterer 2001-04-24 23:06:51 +00:00 committed by Michael Natterer
parent 81e42c92f2
commit 949af6c695
13 changed files with 147 additions and 63 deletions

View File

@ -1,25 +1,39 @@
2001-04-25 Michael Natterer <mitch@gimp.org>
* app/gimpobject.c: : free all the pipe's brushes here.
* app/gimpparasite.c: gimp_personal_rc_file()'s return value has
to be g_free()'d.
* app/main.c: indentation.
Ported memleak fixes from 1.2:
* app/gimpbrush.c: don't leak all pixmaps.
* app/gimpbrushpipe.c: ported memleak fixes from 1.2
2001-04-24 David Neary <dneary@eircom.net>
* app/authors.h: Synced this file from the earlier commit.
* app/pixmaps2.h
* app/pdb/tools_cmds.c
* app/tools/Makefile.am
* app/tools/gimpperspectivetool.c
* app/tools/gimpperspectivetool.h
* app/tools/gimprotatetool.c
* app/tools/gimprotatetool.h
* app/tools/gimpsheartool.c
* app/tools/gimpsheartool.h
* app/tools/gimptool.c
* app/tools/gimptool.h
* app/tools/gimptransformtool.c
* app/tools/tools.c
* tools/pdbgen/pdb/tools.pdb: Enabled the rest of the
transform tools and changed some of the options stuff in
transform_options_new(). There are one or two outstanding
(non-critical) runtime problems in that function.
* app/authors.h: Synced this file from the earlier commit.
* app/pixmaps2.h
* app/pdb/tools_cmds.c
* app/tools/Makefile.am
* app/tools/gimpperspectivetool.c
* app/tools/gimpperspectivetool.h
* app/tools/gimprotatetool.c
* app/tools/gimprotatetool.h
* app/tools/gimpsheartool.c
* app/tools/gimpsheartool.h
* app/tools/gimptool.c
* app/tools/gimptool.h
* app/tools/gimptransformtool.c
* app/tools/tools.c
* tools/pdbgen/pdb/tools.pdb: Enabled the rest of the
transform tools and changed some of the options stuff in
transform_options_new(). There are one or two outstanding
(non-critical) runtime problems in that function.
2001-04-24 Michael Natterer <mitch@gimp.org>

View File

@ -129,15 +129,19 @@ save_func (gchar *key,
void
gimp_parasiterc_save (void)
{
gchar *filename;
gchar *tmp_filename = NULL;
gchar *bak_filename = NULL;
gchar *rc_filename = NULL;
FILE *fp;
filename = gimp_personal_rc_file ("#parasiterc.tmp~");
tmp_filename = gimp_personal_rc_file ("#parasiterc.tmp~");
bak_filename = gimp_personal_rc_file ("parasiterc.bak");
rc_filename = gimp_personal_rc_file ("parasiterc");
fp = fopen (tmp_filename, "w");
fp = fopen (filename, "w");
g_free (filename);
if (!fp)
return;
goto cleanup;
fprintf (fp,
"# GIMP parasiterc\n"
@ -150,21 +154,23 @@ gimp_parasiterc_save (void)
#if defined(G_OS_WIN32) || defined(__EMX__)
/* First rename the old parasiterc out of the way */
unlink (gimp_personal_rc_file ("parasiterc.bak"));
rename (gimp_personal_rc_file ("parasiterc"),
gimp_personal_rc_file ("parasiterc.bak"));
unlink (bak_filename);
rename (rc_filename, bak_filename);
#endif
if (rename (gimp_personal_rc_file ("#parasiterc.tmp~"),
gimp_personal_rc_file ("parasiterc")) != 0)
if (rename (tmp_filename, rc_filename) != 0)
{
#if defined(G_OS_WIN32) || defined(__EMX__)
/* Rename the old parasiterc back */
rename (gimp_personal_rc_file ("parasiterc.bak"),
gimp_personal_rc_file ("parasiterc"));
rename (bak_filename, rc_filename);
#endif
unlink (gimp_personal_rc_file ("#parasiterc.tmp~"));
unlink (tmp_filename);
}
cleanup:
g_free (tmp_filename);
g_free (bak_filename);
g_free (rc_filename);
}
void

View File

@ -142,6 +142,9 @@ gimp_brush_destroy (GtkObject *object)
if (brush->mask)
temp_buf_free (brush->mask);
if (brush->pixmap)
temp_buf_free (brush->pixmap);
if (GTK_OBJECT_CLASS (parent_class)->destroy)
GTK_OBJECT_CLASS (parent_class)->destroy (object);
}

View File

@ -142,6 +142,9 @@ gimp_brush_destroy (GtkObject *object)
if (brush->mask)
temp_buf_free (brush->mask);
if (brush->pixmap)
temp_buf_free (brush->pixmap);
if (GTK_OBJECT_CLASS (parent_class)->destroy)
GTK_OBJECT_CLASS (parent_class)->destroy (object);
}

View File

@ -168,7 +168,7 @@ gimp_brush_pipe_destroy (GtkObject *object)
g_free (pipe->rank);
g_free (pipe->stride);
for (i = 1; i < pipe->nbrushes; i++)
for (i = 0; i < pipe->nbrushes; i++)
if (pipe->brushes[i])
gtk_object_unref (GTK_OBJECT (pipe->brushes[i]));
@ -176,6 +176,9 @@ gimp_brush_pipe_destroy (GtkObject *object)
g_free (pipe->select);
g_free (pipe->index);
GIMP_BRUSH (pipe)->mask = NULL;
GIMP_BRUSH (pipe)->pixmap = NULL;
if (GTK_OBJECT_CLASS (parent_class)->destroy)
GTK_OBJECT_CLASS (parent_class)->destroy (object);
}

View File

@ -168,7 +168,7 @@ gimp_brush_pipe_destroy (GtkObject *object)
g_free (pipe->rank);
g_free (pipe->stride);
for (i = 1; i < pipe->nbrushes; i++)
for (i = 0; i < pipe->nbrushes; i++)
if (pipe->brushes[i])
gtk_object_unref (GTK_OBJECT (pipe->brushes[i]));
@ -176,6 +176,9 @@ gimp_brush_pipe_destroy (GtkObject *object)
g_free (pipe->select);
g_free (pipe->index);
GIMP_BRUSH (pipe)->mask = NULL;
GIMP_BRUSH (pipe)->pixmap = NULL;
if (GTK_OBJECT_CLASS (parent_class)->destroy)
GTK_OBJECT_CLASS (parent_class)->destroy (object);
}

View File

@ -42,6 +42,8 @@ enum
static void gimp_object_class_init (GimpObjectClass *klass);
static void gimp_object_init (GimpObject *object);
static void gimp_object_destroy (GtkObject *object);
static void gimp_object_set_arg (GtkObject *object,
GtkArg *arg,
guint arg_id);
@ -103,6 +105,7 @@ gimp_object_class_init (GimpObjectClass *klass)
gtk_object_class_add_signals (object_class, object_signals, LAST_SIGNAL);
object_class->destroy = gimp_object_destroy;
object_class->set_arg = gimp_object_set_arg;
object_class->get_arg = gimp_object_get_arg;
@ -115,6 +118,20 @@ gimp_object_init (GimpObject *object)
object->name = NULL;
}
static void
gimp_object_destroy (GtkObject *object)
{
GimpObject *gimp_object;
gimp_object = GIMP_OBJECT (object);
g_free (gimp_object->name);
gimp_object->name = NULL;
if (GTK_OBJECT_CLASS (parent_class)->destroy)
GTK_OBJECT_CLASS (parent_class)->destroy (object);
}
static void
gimp_object_set_arg (GtkObject *object,
GtkArg *arg,

View File

@ -129,15 +129,19 @@ save_func (gchar *key,
void
gimp_parasiterc_save (void)
{
gchar *filename;
gchar *tmp_filename = NULL;
gchar *bak_filename = NULL;
gchar *rc_filename = NULL;
FILE *fp;
filename = gimp_personal_rc_file ("#parasiterc.tmp~");
tmp_filename = gimp_personal_rc_file ("#parasiterc.tmp~");
bak_filename = gimp_personal_rc_file ("parasiterc.bak");
rc_filename = gimp_personal_rc_file ("parasiterc");
fp = fopen (tmp_filename, "w");
fp = fopen (filename, "w");
g_free (filename);
if (!fp)
return;
goto cleanup;
fprintf (fp,
"# GIMP parasiterc\n"
@ -150,21 +154,23 @@ gimp_parasiterc_save (void)
#if defined(G_OS_WIN32) || defined(__EMX__)
/* First rename the old parasiterc out of the way */
unlink (gimp_personal_rc_file ("parasiterc.bak"));
rename (gimp_personal_rc_file ("parasiterc"),
gimp_personal_rc_file ("parasiterc.bak"));
unlink (bak_filename);
rename (rc_filename, bak_filename);
#endif
if (rename (gimp_personal_rc_file ("#parasiterc.tmp~"),
gimp_personal_rc_file ("parasiterc")) != 0)
if (rename (tmp_filename, rc_filename) != 0)
{
#if defined(G_OS_WIN32) || defined(__EMX__)
/* Rename the old parasiterc back */
rename (gimp_personal_rc_file ("parasiterc.bak"),
gimp_personal_rc_file ("parasiterc"));
rename (bak_filename, rc_filename);
#endif
unlink (gimp_personal_rc_file ("#parasiterc.tmp~"));
unlink (tmp_filename);
}
cleanup:
g_free (tmp_filename);
g_free (bak_filename);
g_free (rc_filename);
}
void

View File

@ -142,6 +142,9 @@ gimp_brush_destroy (GtkObject *object)
if (brush->mask)
temp_buf_free (brush->mask);
if (brush->pixmap)
temp_buf_free (brush->pixmap);
if (GTK_OBJECT_CLASS (parent_class)->destroy)
GTK_OBJECT_CLASS (parent_class)->destroy (object);
}

View File

@ -168,7 +168,7 @@ gimp_brush_pipe_destroy (GtkObject *object)
g_free (pipe->rank);
g_free (pipe->stride);
for (i = 1; i < pipe->nbrushes; i++)
for (i = 0; i < pipe->nbrushes; i++)
if (pipe->brushes[i])
gtk_object_unref (GTK_OBJECT (pipe->brushes[i]));
@ -176,6 +176,9 @@ gimp_brush_pipe_destroy (GtkObject *object)
g_free (pipe->select);
g_free (pipe->index);
GIMP_BRUSH (pipe)->mask = NULL;
GIMP_BRUSH (pipe)->pixmap = NULL;
if (GTK_OBJECT_CLASS (parent_class)->destroy)
GTK_OBJECT_CLASS (parent_class)->destroy (object);
}

View File

@ -42,6 +42,8 @@ enum
static void gimp_object_class_init (GimpObjectClass *klass);
static void gimp_object_init (GimpObject *object);
static void gimp_object_destroy (GtkObject *object);
static void gimp_object_set_arg (GtkObject *object,
GtkArg *arg,
guint arg_id);
@ -103,6 +105,7 @@ gimp_object_class_init (GimpObjectClass *klass)
gtk_object_class_add_signals (object_class, object_signals, LAST_SIGNAL);
object_class->destroy = gimp_object_destroy;
object_class->set_arg = gimp_object_set_arg;
object_class->get_arg = gimp_object_get_arg;
@ -115,6 +118,20 @@ gimp_object_init (GimpObject *object)
object->name = NULL;
}
static void
gimp_object_destroy (GtkObject *object)
{
GimpObject *gimp_object;
gimp_object = GIMP_OBJECT (object);
g_free (gimp_object->name);
gimp_object->name = NULL;
if (GTK_OBJECT_CLASS (parent_class)->destroy)
GTK_OBJECT_CLASS (parent_class)->destroy (object);
}
static void
gimp_object_set_arg (GtkObject *object,
GtkArg *arg,

View File

@ -129,15 +129,19 @@ save_func (gchar *key,
void
gimp_parasiterc_save (void)
{
gchar *filename;
gchar *tmp_filename = NULL;
gchar *bak_filename = NULL;
gchar *rc_filename = NULL;
FILE *fp;
filename = gimp_personal_rc_file ("#parasiterc.tmp~");
tmp_filename = gimp_personal_rc_file ("#parasiterc.tmp~");
bak_filename = gimp_personal_rc_file ("parasiterc.bak");
rc_filename = gimp_personal_rc_file ("parasiterc");
fp = fopen (tmp_filename, "w");
fp = fopen (filename, "w");
g_free (filename);
if (!fp)
return;
goto cleanup;
fprintf (fp,
"# GIMP parasiterc\n"
@ -150,21 +154,23 @@ gimp_parasiterc_save (void)
#if defined(G_OS_WIN32) || defined(__EMX__)
/* First rename the old parasiterc out of the way */
unlink (gimp_personal_rc_file ("parasiterc.bak"));
rename (gimp_personal_rc_file ("parasiterc"),
gimp_personal_rc_file ("parasiterc.bak"));
unlink (bak_filename);
rename (rc_filename, bak_filename);
#endif
if (rename (gimp_personal_rc_file ("#parasiterc.tmp~"),
gimp_personal_rc_file ("parasiterc")) != 0)
if (rename (tmp_filename, rc_filename) != 0)
{
#if defined(G_OS_WIN32) || defined(__EMX__)
/* Rename the old parasiterc back */
rename (gimp_personal_rc_file ("parasiterc.bak"),
gimp_personal_rc_file ("parasiterc"));
rename (bak_filename, rc_filename);
#endif
unlink (gimp_personal_rc_file ("#parasiterc.tmp~"));
unlink (tmp_filename);
}
cleanup:
g_free (tmp_filename);
g_free (bak_filename);
g_free (rc_filename);
}
void

View File

@ -295,8 +295,8 @@ main (int argc,
*/
else if (argv[i][0] == '-')
{
g_print (_("\nInvalid option.\n"));
show_help = TRUE;
g_print (_("\nInvalid option \"%s\"\n"), argv[i]);
show_help = TRUE;
}
}