fix memory leak
This commit is contained in:

parent
75baaf34fe
commit
92f0e489b6
@ -1,3 +1,9 @@
|
|||||||
|
Wed Dec 17 23:23:05 1997 Ray Lehtiniemi <rayl@netrover.com>
|
||||||
|
|
||||||
|
* app/brush_select.c (brush_popup_open): fix memory leak
|
||||||
|
|
||||||
|
* app/pattern_select.c (pattern_popup_open): fix memory leak
|
||||||
|
|
||||||
Wed Dec 17 15:33:23 PST 1997 Manish Singh <yosh@gimp.org>
|
Wed Dec 17 15:33:23 PST 1997 Manish Singh <yosh@gimp.org>
|
||||||
|
|
||||||
* plug-ins/pcx/pcx.c: Applied patch to fix PCX saving from
|
* plug-ins/pcx/pcx.c: Applied patch to fix PCX saving from
|
||||||
|
@ -326,6 +326,7 @@ brush_popup_open (BrushSelectP bsp,
|
|||||||
gint scr_w, scr_h;
|
gint scr_w, scr_h;
|
||||||
gchar *src, *buf;
|
gchar *src, *buf;
|
||||||
|
|
||||||
|
/* make sure the popup exists and is not visible */
|
||||||
if (bsp->brush_popup == NULL)
|
if (bsp->brush_popup == NULL)
|
||||||
{
|
{
|
||||||
GtkWidget *frame;
|
GtkWidget *frame;
|
||||||
@ -342,8 +343,11 @@ brush_popup_open (BrushSelectP bsp,
|
|||||||
gtk_widget_show (bsp->brush_preview);
|
gtk_widget_show (bsp->brush_preview);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
gtk_widget_hide (bsp->brush_popup);
|
{
|
||||||
|
gtk_widget_hide (bsp->brush_popup);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* decide where to put the popup */
|
||||||
gdk_window_get_origin (bsp->preview->window, &x_org, &y_org);
|
gdk_window_get_origin (bsp->preview->window, &x_org, &y_org);
|
||||||
scr_w = gdk_screen_width ();
|
scr_w = gdk_screen_width ();
|
||||||
scr_h = gdk_screen_height ();
|
scr_h = gdk_screen_height ();
|
||||||
@ -356,6 +360,7 @@ brush_popup_open (BrushSelectP bsp,
|
|||||||
gtk_preview_size (GTK_PREVIEW (bsp->brush_preview), brush->mask->width, brush->mask->height);
|
gtk_preview_size (GTK_PREVIEW (bsp->brush_preview), brush->mask->width, brush->mask->height);
|
||||||
|
|
||||||
gtk_widget_popup (bsp->brush_popup, x, y);
|
gtk_widget_popup (bsp->brush_popup, x, y);
|
||||||
|
|
||||||
/* Draw the brush */
|
/* Draw the brush */
|
||||||
buf = g_new (gchar, brush->mask->width);
|
buf = g_new (gchar, brush->mask->width);
|
||||||
src = temp_buf_data (brush->mask);
|
src = temp_buf_data (brush->mask);
|
||||||
@ -371,6 +376,8 @@ brush_popup_open (BrushSelectP bsp,
|
|||||||
gtk_preview_draw_row (GTK_PREVIEW (bsp->brush_preview), buf, 0, y, brush->mask->width);
|
gtk_preview_draw_row (GTK_PREVIEW (bsp->brush_preview), buf, 0, y, brush->mask->width);
|
||||||
src += brush->mask->width;
|
src += brush->mask->width;
|
||||||
}
|
}
|
||||||
|
g_free(buf);
|
||||||
|
|
||||||
/* Draw the brush preview */
|
/* Draw the brush preview */
|
||||||
gtk_widget_draw (bsp->brush_preview, NULL);
|
gtk_widget_draw (bsp->brush_preview, NULL);
|
||||||
}
|
}
|
||||||
|
@ -326,6 +326,7 @@ brush_popup_open (BrushSelectP bsp,
|
|||||||
gint scr_w, scr_h;
|
gint scr_w, scr_h;
|
||||||
gchar *src, *buf;
|
gchar *src, *buf;
|
||||||
|
|
||||||
|
/* make sure the popup exists and is not visible */
|
||||||
if (bsp->brush_popup == NULL)
|
if (bsp->brush_popup == NULL)
|
||||||
{
|
{
|
||||||
GtkWidget *frame;
|
GtkWidget *frame;
|
||||||
@ -342,8 +343,11 @@ brush_popup_open (BrushSelectP bsp,
|
|||||||
gtk_widget_show (bsp->brush_preview);
|
gtk_widget_show (bsp->brush_preview);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
gtk_widget_hide (bsp->brush_popup);
|
{
|
||||||
|
gtk_widget_hide (bsp->brush_popup);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* decide where to put the popup */
|
||||||
gdk_window_get_origin (bsp->preview->window, &x_org, &y_org);
|
gdk_window_get_origin (bsp->preview->window, &x_org, &y_org);
|
||||||
scr_w = gdk_screen_width ();
|
scr_w = gdk_screen_width ();
|
||||||
scr_h = gdk_screen_height ();
|
scr_h = gdk_screen_height ();
|
||||||
@ -356,6 +360,7 @@ brush_popup_open (BrushSelectP bsp,
|
|||||||
gtk_preview_size (GTK_PREVIEW (bsp->brush_preview), brush->mask->width, brush->mask->height);
|
gtk_preview_size (GTK_PREVIEW (bsp->brush_preview), brush->mask->width, brush->mask->height);
|
||||||
|
|
||||||
gtk_widget_popup (bsp->brush_popup, x, y);
|
gtk_widget_popup (bsp->brush_popup, x, y);
|
||||||
|
|
||||||
/* Draw the brush */
|
/* Draw the brush */
|
||||||
buf = g_new (gchar, brush->mask->width);
|
buf = g_new (gchar, brush->mask->width);
|
||||||
src = temp_buf_data (brush->mask);
|
src = temp_buf_data (brush->mask);
|
||||||
@ -371,6 +376,8 @@ brush_popup_open (BrushSelectP bsp,
|
|||||||
gtk_preview_draw_row (GTK_PREVIEW (bsp->brush_preview), buf, 0, y, brush->mask->width);
|
gtk_preview_draw_row (GTK_PREVIEW (bsp->brush_preview), buf, 0, y, brush->mask->width);
|
||||||
src += brush->mask->width;
|
src += brush->mask->width;
|
||||||
}
|
}
|
||||||
|
g_free(buf);
|
||||||
|
|
||||||
/* Draw the brush preview */
|
/* Draw the brush preview */
|
||||||
gtk_widget_draw (bsp->brush_preview, NULL);
|
gtk_widget_draw (bsp->brush_preview, NULL);
|
||||||
}
|
}
|
||||||
|
@ -215,6 +215,8 @@ pattern_popup_open (PatternSelectP psp,
|
|||||||
gint x_org, y_org;
|
gint x_org, y_org;
|
||||||
gint scr_w, scr_h;
|
gint scr_w, scr_h;
|
||||||
gchar *src, *buf;
|
gchar *src, *buf;
|
||||||
|
|
||||||
|
/* make sure the popup exists and is not visible */
|
||||||
if (psp->pattern_popup == NULL)
|
if (psp->pattern_popup == NULL)
|
||||||
{
|
{
|
||||||
GtkWidget *frame;
|
GtkWidget *frame;
|
||||||
@ -229,7 +231,11 @@ pattern_popup_open (PatternSelectP psp,
|
|||||||
gtk_widget_show (psp->pattern_preview);
|
gtk_widget_show (psp->pattern_preview);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
gtk_widget_hide (psp->pattern_popup);
|
{
|
||||||
|
gtk_widget_hide (psp->pattern_popup);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* decide where to put the popup */
|
||||||
gdk_window_get_origin (psp->preview->window, &x_org, &y_org);
|
gdk_window_get_origin (psp->preview->window, &x_org, &y_org);
|
||||||
scr_w = gdk_screen_width ();
|
scr_w = gdk_screen_width ();
|
||||||
scr_h = gdk_screen_height ();
|
scr_h = gdk_screen_height ();
|
||||||
@ -241,6 +247,7 @@ pattern_popup_open (PatternSelectP psp,
|
|||||||
y = (y + pattern->mask->height > scr_h) ? scr_h - pattern->mask->height : y;
|
y = (y + pattern->mask->height > scr_h) ? scr_h - pattern->mask->height : y;
|
||||||
gtk_preview_size (GTK_PREVIEW (psp->pattern_preview), pattern->mask->width, pattern->mask->height);
|
gtk_preview_size (GTK_PREVIEW (psp->pattern_preview), pattern->mask->width, pattern->mask->height);
|
||||||
gtk_widget_popup (psp->pattern_popup, x, y);
|
gtk_widget_popup (psp->pattern_popup, x, y);
|
||||||
|
|
||||||
/* Draw the pattern */
|
/* Draw the pattern */
|
||||||
buf = g_new (gchar, pattern->mask->width * 3);
|
buf = g_new (gchar, pattern->mask->width * 3);
|
||||||
src = temp_buf_data (pattern->mask);
|
src = temp_buf_data (pattern->mask);
|
||||||
@ -263,15 +270,19 @@ pattern_popup_open (PatternSelectP psp,
|
|||||||
gtk_preview_draw_row (GTK_PREVIEW (psp->pattern_preview), buf, 0, y, pattern->mask->width);
|
gtk_preview_draw_row (GTK_PREVIEW (psp->pattern_preview), buf, 0, y, pattern->mask->width);
|
||||||
src += pattern->mask->width * pattern->mask->bytes;
|
src += pattern->mask->width * pattern->mask->bytes;
|
||||||
}
|
}
|
||||||
|
g_free(buf);
|
||||||
|
|
||||||
/* Draw the pattern preview */
|
/* Draw the pattern preview */
|
||||||
gtk_widget_draw (psp->pattern_preview, NULL);
|
gtk_widget_draw (psp->pattern_preview, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
pattern_popup_close (PatternSelectP psp)
|
pattern_popup_close (PatternSelectP psp)
|
||||||
{
|
{
|
||||||
if (psp->pattern_popup != NULL)
|
if (psp->pattern_popup != NULL)
|
||||||
gtk_widget_hide (psp->pattern_popup);
|
gtk_widget_hide (psp->pattern_popup);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
display_pattern (PatternSelectP psp,
|
display_pattern (PatternSelectP psp,
|
||||||
GPatternP pattern,
|
GPatternP pattern,
|
||||||
|
@ -215,6 +215,8 @@ pattern_popup_open (PatternSelectP psp,
|
|||||||
gint x_org, y_org;
|
gint x_org, y_org;
|
||||||
gint scr_w, scr_h;
|
gint scr_w, scr_h;
|
||||||
gchar *src, *buf;
|
gchar *src, *buf;
|
||||||
|
|
||||||
|
/* make sure the popup exists and is not visible */
|
||||||
if (psp->pattern_popup == NULL)
|
if (psp->pattern_popup == NULL)
|
||||||
{
|
{
|
||||||
GtkWidget *frame;
|
GtkWidget *frame;
|
||||||
@ -229,7 +231,11 @@ pattern_popup_open (PatternSelectP psp,
|
|||||||
gtk_widget_show (psp->pattern_preview);
|
gtk_widget_show (psp->pattern_preview);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
gtk_widget_hide (psp->pattern_popup);
|
{
|
||||||
|
gtk_widget_hide (psp->pattern_popup);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* decide where to put the popup */
|
||||||
gdk_window_get_origin (psp->preview->window, &x_org, &y_org);
|
gdk_window_get_origin (psp->preview->window, &x_org, &y_org);
|
||||||
scr_w = gdk_screen_width ();
|
scr_w = gdk_screen_width ();
|
||||||
scr_h = gdk_screen_height ();
|
scr_h = gdk_screen_height ();
|
||||||
@ -241,6 +247,7 @@ pattern_popup_open (PatternSelectP psp,
|
|||||||
y = (y + pattern->mask->height > scr_h) ? scr_h - pattern->mask->height : y;
|
y = (y + pattern->mask->height > scr_h) ? scr_h - pattern->mask->height : y;
|
||||||
gtk_preview_size (GTK_PREVIEW (psp->pattern_preview), pattern->mask->width, pattern->mask->height);
|
gtk_preview_size (GTK_PREVIEW (psp->pattern_preview), pattern->mask->width, pattern->mask->height);
|
||||||
gtk_widget_popup (psp->pattern_popup, x, y);
|
gtk_widget_popup (psp->pattern_popup, x, y);
|
||||||
|
|
||||||
/* Draw the pattern */
|
/* Draw the pattern */
|
||||||
buf = g_new (gchar, pattern->mask->width * 3);
|
buf = g_new (gchar, pattern->mask->width * 3);
|
||||||
src = temp_buf_data (pattern->mask);
|
src = temp_buf_data (pattern->mask);
|
||||||
@ -263,15 +270,19 @@ pattern_popup_open (PatternSelectP psp,
|
|||||||
gtk_preview_draw_row (GTK_PREVIEW (psp->pattern_preview), buf, 0, y, pattern->mask->width);
|
gtk_preview_draw_row (GTK_PREVIEW (psp->pattern_preview), buf, 0, y, pattern->mask->width);
|
||||||
src += pattern->mask->width * pattern->mask->bytes;
|
src += pattern->mask->width * pattern->mask->bytes;
|
||||||
}
|
}
|
||||||
|
g_free(buf);
|
||||||
|
|
||||||
/* Draw the pattern preview */
|
/* Draw the pattern preview */
|
||||||
gtk_widget_draw (psp->pattern_preview, NULL);
|
gtk_widget_draw (psp->pattern_preview, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
pattern_popup_close (PatternSelectP psp)
|
pattern_popup_close (PatternSelectP psp)
|
||||||
{
|
{
|
||||||
if (psp->pattern_popup != NULL)
|
if (psp->pattern_popup != NULL)
|
||||||
gtk_widget_hide (psp->pattern_popup);
|
gtk_widget_hide (psp->pattern_popup);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
display_pattern (PatternSelectP psp,
|
display_pattern (PatternSelectP psp,
|
||||||
GPatternP pattern,
|
GPatternP pattern,
|
||||||
|
Reference in New Issue
Block a user