Commit 1ca73a96 authored by Sven Neumann's avatar Sven Neumann Committed by Sven Neumann
Browse files

app/core/gimpbrushpipe.c plugged some obvious memleaks related to the use

2003-01-26  Sven Neumann  <sven@gimp.org>

	* app/core/gimpbrushpipe.c
	* app/gui/about-dialog.c: plugged some obvious memleaks related to
	the use of GRand.
parent a541421e
2003-01-26 Sven Neumann <sven@gimp.org>
* app/core/gimpbrushpipe.c
* app/gui/about-dialog.c: plugged some obvious memleaks related to
the use of GRand.
2003-01-26 Michael Natterer <mitch@gimp.org>
 
* app/plug-in/plug-ins.c
......
......@@ -213,14 +213,14 @@ gimp_brush_pipe_select_brush (GimpBrush *brush,
gdouble angle;
GRand *gr;
/* Initialise random number generator */
gr = g_rand_new();
pipe = GIMP_BRUSH_PIPE (brush);
if (pipe->nbrushes == 1)
return GIMP_BRUSH (pipe->current);
/* Initialise random number generator */
gr = g_rand_new ();
brushix = 0;
for (i = 0; i < pipe->dimension; i++)
{
......@@ -259,6 +259,7 @@ gimp_brush_pipe_select_brush (GimpBrush *brush,
ix = pipe->index[i];
break;
}
pipe->index[i] = CLAMP (ix, 0, pipe->rank[i]-1);
brushix += pipe->stride[i] * pipe->index[i];
}
......
......@@ -213,14 +213,14 @@ gimp_brush_pipe_select_brush (GimpBrush *brush,
gdouble angle;
GRand *gr;
/* Initialise random number generator */
gr = g_rand_new();
pipe = GIMP_BRUSH_PIPE (brush);
if (pipe->nbrushes == 1)
return GIMP_BRUSH (pipe->current);
/* Initialise random number generator */
gr = g_rand_new ();
brushix = 0;
for (i = 0; i < pipe->dimension; i++)
{
......@@ -259,6 +259,7 @@ gimp_brush_pipe_select_brush (GimpBrush *brush,
ix = pipe->index[i];
break;
}
pipe->index[i] = CLAMP (ix, 0, pipe->rank[i]-1);
brushix += pipe->stride[i] * pipe->index[i];
}
......
......@@ -122,16 +122,14 @@ about_dialog_create (void)
gint height;
gint i;
gchar *label_text;
GRand *gr;
gr = g_rand_new();
if (! about_dialog)
{
about_dialog = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_window_set_type_hint (GTK_WINDOW (about_dialog),
GDK_WINDOW_TYPE_HINT_DIALOG);
gtk_window_set_wmclass (GTK_WINDOW (about_dialog), "about_dialog", "Gimp");
gtk_window_set_wmclass (GTK_WINDOW (about_dialog),
"about_dialog", "Gimp");
gtk_window_set_title (GTK_WINDOW (about_dialog), _("About The GIMP"));
gtk_window_set_position (GTK_WINDOW (about_dialog), GTK_WIN_POS_CENTER);
gtk_window_set_resizable (GTK_WINDOW (about_dialog), FALSE);
......@@ -247,7 +245,8 @@ about_dialog_create (void)
gtk_container_add (GTK_CONTAINER (aboutframe), scroll_area);
gtk_widget_show (scroll_area);
label = gtk_label_new (_("Visit http://www.gimp.org/ for more information"));
label =
gtk_label_new (_("Visit http://www.gimp.org/ for more information"));
gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, TRUE, 0);
gtk_widget_show (label);
......@@ -267,6 +266,8 @@ about_dialog_create (void)
if (! double_speed && hadja_state != 7)
{
GRand *gr = g_rand_new ();
for (i = 0; i < nscroll_texts; i++)
{
shuffle_array[i] = i;
......@@ -286,17 +287,17 @@ about_dialog_create (void)
shuffle_array[i] = t;
}
}
cur_scroll_text = g_rand_int_range(gr, 0, nscroll_texts);
cur_scroll_text = g_rand_int_range (gr, 0, nscroll_texts);
pango_layout_set_text (scroll_layout,
scroll_text[cur_scroll_text], -1);
g_rand_free (gr);
}
}
gtk_window_present (GTK_WINDOW (about_dialog));
g_rand_free (gr);
return about_dialog;
}
......@@ -309,8 +310,6 @@ about_dialog_load_logo (GtkWidget *window)
gint i, j, k;
GRand *gr;
gr = g_rand_new();
if (logo_pixmap)
return TRUE;
......@@ -358,6 +357,8 @@ about_dialog_load_logo (GtkWidget *window)
dissolve_map = g_new (guchar, dissolve_width * dissolve_height);
gr = g_rand_new ();
for (i = 0, k = 0; i < dissolve_height; i++)
for (j = 0; j < dissolve_width; j++, k++)
dissolve_map[k] = g_rand_int_range (gr, 0, ANIMATION_STEPS);
......
......@@ -122,16 +122,14 @@ about_dialog_create (void)
gint height;
gint i;
gchar *label_text;
GRand *gr;
gr = g_rand_new();
if (! about_dialog)
{
about_dialog = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_window_set_type_hint (GTK_WINDOW (about_dialog),
GDK_WINDOW_TYPE_HINT_DIALOG);
gtk_window_set_wmclass (GTK_WINDOW (about_dialog), "about_dialog", "Gimp");
gtk_window_set_wmclass (GTK_WINDOW (about_dialog),
"about_dialog", "Gimp");
gtk_window_set_title (GTK_WINDOW (about_dialog), _("About The GIMP"));
gtk_window_set_position (GTK_WINDOW (about_dialog), GTK_WIN_POS_CENTER);
gtk_window_set_resizable (GTK_WINDOW (about_dialog), FALSE);
......@@ -247,7 +245,8 @@ about_dialog_create (void)
gtk_container_add (GTK_CONTAINER (aboutframe), scroll_area);
gtk_widget_show (scroll_area);
label = gtk_label_new (_("Visit http://www.gimp.org/ for more information"));
label =
gtk_label_new (_("Visit http://www.gimp.org/ for more information"));
gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, TRUE, 0);
gtk_widget_show (label);
......@@ -267,6 +266,8 @@ about_dialog_create (void)
if (! double_speed && hadja_state != 7)
{
GRand *gr = g_rand_new ();
for (i = 0; i < nscroll_texts; i++)
{
shuffle_array[i] = i;
......@@ -286,17 +287,17 @@ about_dialog_create (void)
shuffle_array[i] = t;
}
}
cur_scroll_text = g_rand_int_range(gr, 0, nscroll_texts);
cur_scroll_text = g_rand_int_range (gr, 0, nscroll_texts);
pango_layout_set_text (scroll_layout,
scroll_text[cur_scroll_text], -1);
g_rand_free (gr);
}
}
gtk_window_present (GTK_WINDOW (about_dialog));
g_rand_free (gr);
return about_dialog;
}
......@@ -309,8 +310,6 @@ about_dialog_load_logo (GtkWidget *window)
gint i, j, k;
GRand *gr;
gr = g_rand_new();
if (logo_pixmap)
return TRUE;
......@@ -358,6 +357,8 @@ about_dialog_load_logo (GtkWidget *window)
dissolve_map = g_new (guchar, dissolve_width * dissolve_height);
gr = g_rand_new ();
for (i = 0, k = 0; i < dissolve_height; i++)
for (j = 0; j < dissolve_width; j++, k++)
dissolve_map[k] = g_rand_int_range (gr, 0, ANIMATION_STEPS);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment