diff options
author | Tim Janik <timj@gtk.org> | 1999-03-17 10:32:33 +0000 |
---|---|---|
committer | Tim Janik <timj@src.gnome.org> | 1999-03-17 10:32:33 +0000 |
commit | 8b424288ba75721f39e76ffad78dd16497a5bc34 (patch) | |
tree | 5a09f69af0dacade6e63b2a91709d0adf5974ac1 | |
parent | f880eba7cd72302ffa34cc938a3a3085ed3e7848 (diff) | |
download | gdk-pixbuf-8b424288ba75721f39e76ffad78dd16497a5bc34.tar.gz |
plugging problems reported by "Bruce Mitchener, Jr." <bruce@puremagic.com>
Wed Mar 17 09:00:00 1999 Tim Janik <timj@gtk.org>
* plugging problems reported by "Bruce Mitchener, Jr."
<bruce@puremagic.com> due to a purify session.
* gtk/gtkstyle.c:
(gtk_style_ref):
(gtk_style_unref): assert ref_count to be > 0.
* gtk/gtkclist.c (gtk_clist_set_cell_style): { 0 } initilaize
the requisition.
(gtk_clist_set_shift): likewise.
* gtk/gtklayout.c: introduce gtk_layout_finalize() to unref the
adjustments.
* gdk/gdkselection.c (gdk_selection_property_get): first XFree(t),
then reset it to NULL.
* gtk/gtklist.c (gtk_list_horizontal_timeout): zero initialize the
event before sending it and set send_event to TRUE (which needs to
be done for *all* synthesized events).
(gtk_list_vertical_timeout): likewise.
* gdk/gdkcolor.c:
(gdk_colors_free):
(gdk_colormap_free_colors): use colormap->colors[in_pixels[i]] as the
key for g_hash_table_remove() in both functions, this prevents us
from accessing possibly uninitialized portions of a GdkColor structure
where we are only interested in its pixel value.
* gtk/gtktipsquery.c (gtk_tips_query_destroy): plug small memory
leaks.
* gtk/gtkdrawingarea.c (gtk_drawing_area_send_configure): set send_event
to TRUE when synthesizing events.
-rw-r--r-- | ChangeLog | 37 | ||||
-rw-r--r-- | ChangeLog.pre-2-0 | 37 | ||||
-rw-r--r-- | ChangeLog.pre-2-10 | 37 | ||||
-rw-r--r-- | ChangeLog.pre-2-2 | 37 | ||||
-rw-r--r-- | ChangeLog.pre-2-4 | 37 | ||||
-rw-r--r-- | ChangeLog.pre-2-6 | 37 | ||||
-rw-r--r-- | ChangeLog.pre-2-8 | 37 | ||||
-rw-r--r-- | gdk/gdkcolor.c | 196 | ||||
-rw-r--r-- | gdk/gdkselection.c | 6 | ||||
-rw-r--r-- | gdk/x11/gdkcolor-x11.c | 196 | ||||
-rw-r--r-- | gdk/x11/gdkselection-x11.c | 6 | ||||
-rw-r--r-- | gtk/gtkclist.c | 4 | ||||
-rw-r--r-- | gtk/gtkdrawingarea.c | 1 | ||||
-rw-r--r-- | gtk/gtklayout.c | 24 | ||||
-rw-r--r-- | gtk/gtklist.c | 10 | ||||
-rw-r--r-- | gtk/gtkstyle.c | 2 | ||||
-rw-r--r-- | gtk/gtktipsquery.c | 5 | ||||
-rw-r--r-- | gtk/testgtk.c | 7 | ||||
-rw-r--r-- | tests/testgtk.c | 7 |
19 files changed, 508 insertions, 215 deletions
@@ -1,3 +1,40 @@ +Wed Mar 17 09:00:00 1999 Tim Janik <timj@gtk.org> + + * plugging problems reported by "Bruce Mitchener, Jr." + <bruce@puremagic.com> due to a purify session. + + * gtk/gtkstyle.c: + (gtk_style_ref): + (gtk_style_unref): assert ref_count to be > 0. + + * gtk/gtkclist.c (gtk_clist_set_cell_style): { 0 } initilaize + the requisition. + (gtk_clist_set_shift): likewise. + + * gtk/gtklayout.c: introduce gtk_layout_finalize() to unref the + adjustments. + + * gdk/gdkselection.c (gdk_selection_property_get): first XFree(t), + then reset it to NULL. + + * gtk/gtklist.c (gtk_list_horizontal_timeout): zero initialize the + event before sending it and set send_event to TRUE (which needs to + be done for *all* synthesized events). + (gtk_list_vertical_timeout): likewise. + + * gdk/gdkcolor.c: + (gdk_colors_free): + (gdk_colormap_free_colors): use colormap->colors[in_pixels[i]] as the + key for g_hash_table_remove() in both functions, this prevents us + from accessing possibly uninitialized portions of a GdkColor structure + where we are only interested in its pixel value. + + * gtk/gtktipsquery.c (gtk_tips_query_destroy): plug small memory + leaks. + + * gtk/gtkdrawingarea.c (gtk_drawing_area_send_configure): set send_event + to TRUE when synthesizing events. + Wed Mar 17 00:44:23 1999 Tim Janik <timj@gtk.org> * configure.in: bumped version number to Gtk+1.2.1, interface 0, diff --git a/ChangeLog.pre-2-0 b/ChangeLog.pre-2-0 index b24d79545..04a4e214d 100644 --- a/ChangeLog.pre-2-0 +++ b/ChangeLog.pre-2-0 @@ -1,3 +1,40 @@ +Wed Mar 17 09:00:00 1999 Tim Janik <timj@gtk.org> + + * plugging problems reported by "Bruce Mitchener, Jr." + <bruce@puremagic.com> due to a purify session. + + * gtk/gtkstyle.c: + (gtk_style_ref): + (gtk_style_unref): assert ref_count to be > 0. + + * gtk/gtkclist.c (gtk_clist_set_cell_style): { 0 } initilaize + the requisition. + (gtk_clist_set_shift): likewise. + + * gtk/gtklayout.c: introduce gtk_layout_finalize() to unref the + adjustments. + + * gdk/gdkselection.c (gdk_selection_property_get): first XFree(t), + then reset it to NULL. + + * gtk/gtklist.c (gtk_list_horizontal_timeout): zero initialize the + event before sending it and set send_event to TRUE (which needs to + be done for *all* synthesized events). + (gtk_list_vertical_timeout): likewise. + + * gdk/gdkcolor.c: + (gdk_colors_free): + (gdk_colormap_free_colors): use colormap->colors[in_pixels[i]] as the + key for g_hash_table_remove() in both functions, this prevents us + from accessing possibly uninitialized portions of a GdkColor structure + where we are only interested in its pixel value. + + * gtk/gtktipsquery.c (gtk_tips_query_destroy): plug small memory + leaks. + + * gtk/gtkdrawingarea.c (gtk_drawing_area_send_configure): set send_event + to TRUE when synthesizing events. + Wed Mar 17 00:44:23 1999 Tim Janik <timj@gtk.org> * configure.in: bumped version number to Gtk+1.2.1, interface 0, diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index b24d79545..04a4e214d 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,3 +1,40 @@ +Wed Mar 17 09:00:00 1999 Tim Janik <timj@gtk.org> + + * plugging problems reported by "Bruce Mitchener, Jr." + <bruce@puremagic.com> due to a purify session. + + * gtk/gtkstyle.c: + (gtk_style_ref): + (gtk_style_unref): assert ref_count to be > 0. + + * gtk/gtkclist.c (gtk_clist_set_cell_style): { 0 } initilaize + the requisition. + (gtk_clist_set_shift): likewise. + + * gtk/gtklayout.c: introduce gtk_layout_finalize() to unref the + adjustments. + + * gdk/gdkselection.c (gdk_selection_property_get): first XFree(t), + then reset it to NULL. + + * gtk/gtklist.c (gtk_list_horizontal_timeout): zero initialize the + event before sending it and set send_event to TRUE (which needs to + be done for *all* synthesized events). + (gtk_list_vertical_timeout): likewise. + + * gdk/gdkcolor.c: + (gdk_colors_free): + (gdk_colormap_free_colors): use colormap->colors[in_pixels[i]] as the + key for g_hash_table_remove() in both functions, this prevents us + from accessing possibly uninitialized portions of a GdkColor structure + where we are only interested in its pixel value. + + * gtk/gtktipsquery.c (gtk_tips_query_destroy): plug small memory + leaks. + + * gtk/gtkdrawingarea.c (gtk_drawing_area_send_configure): set send_event + to TRUE when synthesizing events. + Wed Mar 17 00:44:23 1999 Tim Janik <timj@gtk.org> * configure.in: bumped version number to Gtk+1.2.1, interface 0, diff --git a/ChangeLog.pre-2-2 b/ChangeLog.pre-2-2 index b24d79545..04a4e214d 100644 --- a/ChangeLog.pre-2-2 +++ b/ChangeLog.pre-2-2 @@ -1,3 +1,40 @@ +Wed Mar 17 09:00:00 1999 Tim Janik <timj@gtk.org> + + * plugging problems reported by "Bruce Mitchener, Jr." + <bruce@puremagic.com> due to a purify session. + + * gtk/gtkstyle.c: + (gtk_style_ref): + (gtk_style_unref): assert ref_count to be > 0. + + * gtk/gtkclist.c (gtk_clist_set_cell_style): { 0 } initilaize + the requisition. + (gtk_clist_set_shift): likewise. + + * gtk/gtklayout.c: introduce gtk_layout_finalize() to unref the + adjustments. + + * gdk/gdkselection.c (gdk_selection_property_get): first XFree(t), + then reset it to NULL. + + * gtk/gtklist.c (gtk_list_horizontal_timeout): zero initialize the + event before sending it and set send_event to TRUE (which needs to + be done for *all* synthesized events). + (gtk_list_vertical_timeout): likewise. + + * gdk/gdkcolor.c: + (gdk_colors_free): + (gdk_colormap_free_colors): use colormap->colors[in_pixels[i]] as the + key for g_hash_table_remove() in both functions, this prevents us + from accessing possibly uninitialized portions of a GdkColor structure + where we are only interested in its pixel value. + + * gtk/gtktipsquery.c (gtk_tips_query_destroy): plug small memory + leaks. + + * gtk/gtkdrawingarea.c (gtk_drawing_area_send_configure): set send_event + to TRUE when synthesizing events. + Wed Mar 17 00:44:23 1999 Tim Janik <timj@gtk.org> * configure.in: bumped version number to Gtk+1.2.1, interface 0, diff --git a/ChangeLog.pre-2-4 b/ChangeLog.pre-2-4 index b24d79545..04a4e214d 100644 --- a/ChangeLog.pre-2-4 +++ b/ChangeLog.pre-2-4 @@ -1,3 +1,40 @@ +Wed Mar 17 09:00:00 1999 Tim Janik <timj@gtk.org> + + * plugging problems reported by "Bruce Mitchener, Jr." + <bruce@puremagic.com> due to a purify session. + + * gtk/gtkstyle.c: + (gtk_style_ref): + (gtk_style_unref): assert ref_count to be > 0. + + * gtk/gtkclist.c (gtk_clist_set_cell_style): { 0 } initilaize + the requisition. + (gtk_clist_set_shift): likewise. + + * gtk/gtklayout.c: introduce gtk_layout_finalize() to unref the + adjustments. + + * gdk/gdkselection.c (gdk_selection_property_get): first XFree(t), + then reset it to NULL. + + * gtk/gtklist.c (gtk_list_horizontal_timeout): zero initialize the + event before sending it and set send_event to TRUE (which needs to + be done for *all* synthesized events). + (gtk_list_vertical_timeout): likewise. + + * gdk/gdkcolor.c: + (gdk_colors_free): + (gdk_colormap_free_colors): use colormap->colors[in_pixels[i]] as the + key for g_hash_table_remove() in both functions, this prevents us + from accessing possibly uninitialized portions of a GdkColor structure + where we are only interested in its pixel value. + + * gtk/gtktipsquery.c (gtk_tips_query_destroy): plug small memory + leaks. + + * gtk/gtkdrawingarea.c (gtk_drawing_area_send_configure): set send_event + to TRUE when synthesizing events. + Wed Mar 17 00:44:23 1999 Tim Janik <timj@gtk.org> * configure.in: bumped version number to Gtk+1.2.1, interface 0, diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6 index b24d79545..04a4e214d 100644 --- a/ChangeLog.pre-2-6 +++ b/ChangeLog.pre-2-6 @@ -1,3 +1,40 @@ +Wed Mar 17 09:00:00 1999 Tim Janik <timj@gtk.org> + + * plugging problems reported by "Bruce Mitchener, Jr." + <bruce@puremagic.com> due to a purify session. + + * gtk/gtkstyle.c: + (gtk_style_ref): + (gtk_style_unref): assert ref_count to be > 0. + + * gtk/gtkclist.c (gtk_clist_set_cell_style): { 0 } initilaize + the requisition. + (gtk_clist_set_shift): likewise. + + * gtk/gtklayout.c: introduce gtk_layout_finalize() to unref the + adjustments. + + * gdk/gdkselection.c (gdk_selection_property_get): first XFree(t), + then reset it to NULL. + + * gtk/gtklist.c (gtk_list_horizontal_timeout): zero initialize the + event before sending it and set send_event to TRUE (which needs to + be done for *all* synthesized events). + (gtk_list_vertical_timeout): likewise. + + * gdk/gdkcolor.c: + (gdk_colors_free): + (gdk_colormap_free_colors): use colormap->colors[in_pixels[i]] as the + key for g_hash_table_remove() in both functions, this prevents us + from accessing possibly uninitialized portions of a GdkColor structure + where we are only interested in its pixel value. + + * gtk/gtktipsquery.c (gtk_tips_query_destroy): plug small memory + leaks. + + * gtk/gtkdrawingarea.c (gtk_drawing_area_send_configure): set send_event + to TRUE when synthesizing events. + Wed Mar 17 00:44:23 1999 Tim Janik <timj@gtk.org> * configure.in: bumped version number to Gtk+1.2.1, interface 0, diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8 index b24d79545..04a4e214d 100644 --- a/ChangeLog.pre-2-8 +++ b/ChangeLog.pre-2-8 @@ -1,3 +1,40 @@ +Wed Mar 17 09:00:00 1999 Tim Janik <timj@gtk.org> + + * plugging problems reported by "Bruce Mitchener, Jr." + <bruce@puremagic.com> due to a purify session. + + * gtk/gtkstyle.c: + (gtk_style_ref): + (gtk_style_unref): assert ref_count to be > 0. + + * gtk/gtkclist.c (gtk_clist_set_cell_style): { 0 } initilaize + the requisition. + (gtk_clist_set_shift): likewise. + + * gtk/gtklayout.c: introduce gtk_layout_finalize() to unref the + adjustments. + + * gdk/gdkselection.c (gdk_selection_property_get): first XFree(t), + then reset it to NULL. + + * gtk/gtklist.c (gtk_list_horizontal_timeout): zero initialize the + event before sending it and set send_event to TRUE (which needs to + be done for *all* synthesized events). + (gtk_list_vertical_timeout): likewise. + + * gdk/gdkcolor.c: + (gdk_colors_free): + (gdk_colormap_free_colors): use colormap->colors[in_pixels[i]] as the + key for g_hash_table_remove() in both functions, this prevents us + from accessing possibly uninitialized portions of a GdkColor structure + where we are only interested in its pixel value. + + * gtk/gtktipsquery.c (gtk_tips_query_destroy): plug small memory + leaks. + + * gtk/gtkdrawingarea.c (gtk_drawing_area_send_configure): set send_event + to TRUE when synthesizing events. + Wed Mar 17 00:44:23 1999 Tim Janik <timj@gtk.org> * configure.in: bumped version number to Gtk+1.2.1, interface 0, diff --git a/gdk/gdkcolor.c b/gdk/gdkcolor.c index 3a274a888..ecdd999e7 100644 --- a/gdk/gdkcolor.c +++ b/gdk/gdkcolor.c @@ -432,55 +432,6 @@ gdk_colors_alloc (GdkColormap *colormap, return return_val; } -/* This is almost identical to gdk_colormap_free_colors. - * Keep them in sync! - */ -void -gdk_colors_free (GdkColormap *colormap, - gulong *in_pixels, - gint in_npixels, - gulong planes) -{ - GdkColormapPrivate *private; - gulong *pixels; - gint npixels = 0; - gint i; - - g_return_if_fail (colormap != NULL); - g_return_if_fail (in_pixels != NULL); - - private = (GdkColormapPrivate*) colormap; - - if ((private->visual->type != GDK_VISUAL_PSEUDO_COLOR) && - (private->visual->type != GDK_VISUAL_GRAYSCALE)) - return; - - pixels = g_new (gulong, in_npixels); - - for (i=0; i<in_npixels; i++) - { - gulong pixel = in_pixels[i]; - - if (private->info[pixel].ref_count) - { - private->info[pixel].ref_count--; - - if (private->info[pixel].ref_count == 0) - { - pixels[npixels++] = pixel; - if (!(private->info[pixel].flags & GDK_COLOR_WRITEABLE)) - g_hash_table_remove (private->hash, &colormap->colors[in_pixels[i]]); - private->info[pixel].flags = 0; - } - } - } - - if (npixels) - XFreeColors (private->xdisplay, private->xcolormap, - pixels, npixels, planes); - g_free (pixels); -} - /* *-------------------------------------------------------------- * gdk_color_copy @@ -609,6 +560,104 @@ gdk_color_parse (const gchar *spec, return return_val; } +/* This is almost identical to gdk_colormap_free_colors. + * Keep them in sync! + */ +void +gdk_colors_free (GdkColormap *colormap, + gulong *in_pixels, + gint in_npixels, + gulong planes) +{ + GdkColormapPrivate *private; + gulong *pixels; + gint npixels = 0; + gint i; + + g_return_if_fail (colormap != NULL); + g_return_if_fail (in_pixels != NULL); + + private = (GdkColormapPrivate*) colormap; + + if ((private->visual->type != GDK_VISUAL_PSEUDO_COLOR) && + (private->visual->type != GDK_VISUAL_GRAYSCALE)) + return; + + pixels = g_new (gulong, in_npixels); + + for (i=0; i<in_npixels; i++) + { + gulong pixel = in_pixels[i]; + + if (private->info[pixel].ref_count) + { + private->info[pixel].ref_count--; + + if (private->info[pixel].ref_count == 0) + { + pixels[npixels++] = pixel; + if (!(private->info[pixel].flags & GDK_COLOR_WRITEABLE)) + g_hash_table_remove (private->hash, &colormap->colors[pixel]); + private->info[pixel].flags = 0; + } + } + } + + if (npixels) + XFreeColors (private->xdisplay, private->xcolormap, + pixels, npixels, planes); + g_free (pixels); +} + +/* This is almost identical to gdk_colors_free. + * Keep them in sync! + */ +void +gdk_colormap_free_colors (GdkColormap *colormap, + GdkColor *colors, + gint ncolors) +{ + GdkColormapPrivate *private; + gulong *pixels; + gint npixels = 0; + gint i; + + g_return_if_fail (colormap != NULL); + g_return_if_fail (colors != NULL); + + private = (GdkColormapPrivate*) colormap; + + if ((private->visual->type != GDK_VISUAL_PSEUDO_COLOR) && + (private->visual->type != GDK_VISUAL_GRAYSCALE)) + return; + + pixels = g_new (gulong, ncolors); + + for (i=0; i<ncolors; i++) + { + gulong pixel = colors[i].pixel; + + if (private->info[pixel].ref_count) + { + private->info[pixel].ref_count--; + + if (private->info[pixel].ref_count == 0) + { + pixels[npixels++] = pixel; + if (!(private->info[pixel].flags & GDK_COLOR_WRITEABLE)) + g_hash_table_remove (private->hash, &colormap->colors[pixel]); + private->info[pixel].flags = 0; + } + } + } + + if (npixels) + XFreeColors (private->xdisplay, private->xcolormap, + pixels, npixels, 0); + + g_free (pixels); +} + /******************** * Color allocation * ********************/ @@ -1026,55 +1075,6 @@ gdk_colormap_alloc_color (GdkColormap *colormap, return success; } -/* This is almost identical to gdk_colors_free. - * Keep them in sync! - */ -void -gdk_colormap_free_colors (GdkColormap *colormap, - GdkColor *colors, - gint ncolors) -{ - GdkColormapPrivate *private; - gulong *pixels; - gint npixels = 0; - gint i; - - g_return_if_fail (colormap != NULL); - g_return_if_fail (colors != NULL); - - private = (GdkColormapPrivate*) colormap; - - if ((private->visual->type != GDK_VISUAL_PSEUDO_COLOR) && - (private->visual->type != GDK_VISUAL_GRAYSCALE)) - return; - - pixels = g_new (gulong, ncolors); - - for (i=0; i<ncolors; i++) - { - gulong pixel = colors[i].pixel; - - if (private->info[pixel].ref_count) - { - private->info[pixel].ref_count--; - - if (private->info[pixel].ref_count == 0) - { - pixels[npixels++] = pixel; - if (!(private->info[pixel].flags & GDK_COLOR_WRITEABLE)) - g_hash_table_remove (private->hash, &colors[i]); - private->info[pixel].flags = 0; - } - } - } - - if (npixels) - XFreeColors (private->xdisplay, private->xcolormap, - pixels, npixels, 0); - - g_free (pixels); -} - gboolean gdk_color_alloc (GdkColormap *colormap, GdkColor *color) diff --git a/gdk/gdkselection.c b/gdk/gdkselection.c index 64a18d042..2ac5c7a3a 100644 --- a/gdk/gdkselection.c +++ b/gdk/gdkselection.c @@ -105,7 +105,7 @@ gdk_selection_property_get (GdkWindow *requestor, gulong length; GdkAtom prop_type; gint prop_format; - guchar *t; + guchar *t = NULL; g_return_val_if_fail (requestor != NULL, 0); @@ -133,11 +133,11 @@ gdk_selection_property_get (GdkWindow *requestor, *data = NULL; return 0; } - + if (t) { - t = NULL; XFree (t); + t = NULL; } /* Add on an extra byte to handle null termination. X guarantees diff --git a/gdk/x11/gdkcolor-x11.c b/gdk/x11/gdkcolor-x11.c index 3a274a888..ecdd999e7 100644 --- a/gdk/x11/gdkcolor-x11.c +++ b/gdk/x11/gdkcolor-x11.c @@ -432,55 +432,6 @@ gdk_colors_alloc (GdkColormap *colormap, return return_val; } -/* This is almost identical to gdk_colormap_free_colors. - * Keep them in sync! - */ -void -gdk_colors_free (GdkColormap *colormap, - gulong *in_pixels, - gint in_npixels, - gulong planes) -{ - GdkColormapPrivate *private; - gulong *pixels; - gint npixels = 0; - gint i; - - g_return_if_fail (colormap != NULL); - g_return_if_fail (in_pixels != NULL); - - private = (GdkColormapPrivate*) colormap; - - if ((private->visual->type != GDK_VISUAL_PSEUDO_COLOR) && - (private->visual->type != GDK_VISUAL_GRAYSCALE)) - return; - - pixels = g_new (gulong, in_npixels); - - for (i=0; i<in_npixels; i++) - { - gulong pixel = in_pixels[i]; - - if (private->info[pixel].ref_count) - { - private->info[pixel].ref_count--; - - if (private->info[pixel].ref_count == 0) - { - pixels[npixels++] = pixel; - if (!(private->info[pixel].flags & GDK_COLOR_WRITEABLE)) - g_hash_table_remove (private->hash, &colormap->colors[in_pixels[i]]); - private->info[pixel].flags = 0; - } - } - } - - if (npixels) - XFreeColors (private->xdisplay, private->xcolormap, - pixels, npixels, planes); - g_free (pixels); -} - /* *-------------------------------------------------------------- * gdk_color_copy @@ -609,6 +560,104 @@ gdk_color_parse (const gchar *spec, return return_val; } +/* This is almost identical to gdk_colormap_free_colors. + * Keep them in sync! + */ +void +gdk_colors_free (GdkColormap *colormap, + gulong *in_pixels, + gint in_npixels, + gulong planes) +{ + GdkColormapPrivate *private; + gulong *pixels; + gint npixels = 0; + gint i; + + g_return_if_fail (colormap != NULL); + g_return_if_fail (in_pixels != NULL); + + private = (GdkColormapPrivate*) colormap; + + if ((private->visual->type != GDK_VISUAL_PSEUDO_COLOR) && + (private->visual->type != GDK_VISUAL_GRAYSCALE)) + return; + + pixels = g_new (gulong, in_npixels); + + for (i=0; i<in_npixels; i++) + { + gulong pixel = in_pixels[i]; + + if (private->info[pixel].ref_count) + { + private->info[pixel].ref_count--; + + if (private->info[pixel].ref_count == 0) + { + pixels[npixels++] = pixel; + if (!(private->info[pixel].flags & GDK_COLOR_WRITEABLE)) + g_hash_table_remove (private->hash, &colormap->colors[pixel]); + private->info[pixel].flags = 0; + } + } + } + + if (npixels) + XFreeColors (private->xdisplay, private->xcolormap, + pixels, npixels, planes); + g_free (pixels); +} + +/* This is almost identical to gdk_colors_free. + * Keep them in sync! + */ +void +gdk_colormap_free_colors (GdkColormap *colormap, + GdkColor *colors, + gint ncolors) +{ + GdkColormapPrivate *private; + gulong *pixels; + gint npixels = 0; + gint i; + + g_return_if_fail (colormap != NULL); + g_return_if_fail (colors != NULL); + + private = (GdkColormapPrivate*) colormap; + + if ((private->visual->type != GDK_VISUAL_PSEUDO_COLOR) && + (private->visual->type != GDK_VISUAL_GRAYSCALE)) + return; + + pixels = g_new (gulong, ncolors); + + for (i=0; i<ncolors; i++) + { + gulong pixel = colors[i].pixel; + + if (private->info[pixel].ref_count) + { + private->info[pixel].ref_count--; + + if (private->info[pixel].ref_count == 0) + { + pixels[npixels++] = pixel; + if (!(private->info[pixel].flags & GDK_COLOR_WRITEABLE)) + g_hash_table_remove (private->hash, &colormap->colors[pixel]); + private->info[pixel].flags = 0; + } + } + } + + if (npixels) + XFreeColors (private->xdisplay, private->xcolormap, + pixels, npixels, 0); + + g_free (pixels); +} + /******************** * Color allocation * ********************/ @@ -1026,55 +1075,6 @@ gdk_colormap_alloc_color (GdkColormap *colormap, return success; } -/* This is almost identical to gdk_colors_free. - * Keep them in sync! - */ -void -gdk_colormap_free_colors (GdkColormap *colormap, - GdkColor *colors, - gint ncolors) -{ - GdkColormapPrivate *private; - gulong *pixels; - gint npixels = 0; - gint i; - - g_return_if_fail (colormap != NULL); - g_return_if_fail (colors != NULL); - - private = (GdkColormapPrivate*) colormap; - - if ((private->visual->type != GDK_VISUAL_PSEUDO_COLOR) && - (private->visual->type != GDK_VISUAL_GRAYSCALE)) - return; - - pixels = g_new (gulong, ncolors); - - for (i=0; i<ncolors; i++) - { - gulong pixel = colors[i].pixel; - - if (private->info[pixel].ref_count) - { - private->info[pixel].ref_count--; - - if (private->info[pixel].ref_count == 0) - { - pixels[npixels++] = pixel; - if (!(private->info[pixel].flags & GDK_COLOR_WRITEABLE)) - g_hash_table_remove (private->hash, &colors[i]); - private->info[pixel].flags = 0; - } - } - } - - if (npixels) - XFreeColors (private->xdisplay, private->xcolormap, - pixels, npixels, 0); - - g_free (pixels); -} - gboolean gdk_color_alloc (GdkColormap *colormap, GdkColor *color) diff --git a/gdk/x11/gdkselection-x11.c b/gdk/x11/gdkselection-x11.c index 64a18d042..2ac5c7a3a 100644 --- a/gdk/x11/gdkselection-x11.c +++ b/gdk/x11/gdkselection-x11.c @@ -105,7 +105,7 @@ gdk_selection_property_get (GdkWindow *requestor, gulong length; GdkAtom prop_type; gint prop_format; - guchar *t; + guchar *t = NULL; g_return_val_if_fail (requestor != NULL, 0); @@ -133,11 +133,11 @@ gdk_selection_property_get (GdkWindow *requestor, *data = NULL; return 0; } - + if (t) { - t = NULL; XFree (t); + t = NULL; } /* Add on an extra byte to handle null termination. X guarantees diff --git a/gtk/gtkclist.c b/gtk/gtkclist.c index 574474837..6d2346dfa 100644 --- a/gtk/gtkclist.c +++ b/gtk/gtkclist.c @@ -2414,7 +2414,7 @@ gtk_clist_set_shift (GtkCList *clist, gint vertical, gint horizontal) { - GtkRequisition requisition; + GtkRequisition requisition = { 0 }; GtkCListRow *clist_row; g_return_if_fail (clist != NULL); @@ -3234,7 +3234,7 @@ gtk_clist_set_cell_style (GtkCList *clist, gint column, GtkStyle *style) { - GtkRequisition requisition; + GtkRequisition requisition = { 0 }; GtkCListRow *clist_row; g_return_if_fail (clist != NULL); diff --git a/gtk/gtkdrawingarea.c b/gtk/gtkdrawingarea.c index 05627c827..9446c2eb9 100644 --- a/gtk/gtkdrawingarea.c +++ b/gtk/gtkdrawingarea.c @@ -160,6 +160,7 @@ gtk_drawing_area_send_configure (GtkDrawingArea *darea) event.type = GDK_CONFIGURE; event.window = widget->window; + event.send_event = TRUE; event.x = widget->allocation.x; event.y = widget->allocation.y; event.width = widget->allocation.width; diff --git a/gtk/gtklayout.c b/gtk/gtklayout.c index f152bc65f..a8cf5321d 100644 --- a/gtk/gtklayout.c +++ b/gtk/gtklayout.c @@ -53,6 +53,7 @@ struct _GtkLayoutChild { static void gtk_layout_class_init (GtkLayoutClass *class); static void gtk_layout_init (GtkLayout *layout); +static void gtk_layout_finalize (GtkObject *object); static void gtk_layout_realize (GtkWidget *widget); static void gtk_layout_unrealize (GtkWidget *widget); static void gtk_layout_map (GtkWidget *widget); @@ -198,6 +199,17 @@ gtk_layout_set_adjustments (GtkLayout *layout, gtk_layout_adjustment_changed (NULL, layout); } +static void +gtk_layout_finalize (GtkObject *object) +{ + GtkLayout *layout = GTK_LAYOUT (object); + + gtk_object_unref (GTK_OBJECT (layout->hadjustment)); + gtk_object_unref (GTK_OBJECT (layout->vadjustment)); + + GTK_OBJECT_CLASS (parent_class)->finalize (object); +} + void gtk_layout_set_hadjustment (GtkLayout *layout, GtkAdjustment *adjustment) @@ -374,6 +386,8 @@ gtk_layout_class_init (GtkLayoutClass *class) parent_class = gtk_type_class (GTK_TYPE_CONTAINER); + object_class->finalize = gtk_layout_finalize; + widget_class->realize = gtk_layout_realize; widget_class->unrealize = gtk_layout_unrealize; widget_class->map = gtk_layout_map; @@ -382,6 +396,11 @@ gtk_layout_class_init (GtkLayoutClass *class) widget_class->draw = gtk_layout_draw; widget_class->expose_event = gtk_layout_expose; + container_class->remove = gtk_layout_remove; + container_class->forall = gtk_layout_forall; + + class->set_scroll_adjustments = gtk_layout_set_adjustments; + widget_class->set_scroll_adjustments_signal = gtk_signal_new ("set_scroll_adjustments", GTK_RUN_LAST, @@ -389,11 +408,6 @@ gtk_layout_class_init (GtkLayoutClass *class) GTK_SIGNAL_OFFSET (GtkLayoutClass, set_scroll_adjustments), gtk_marshal_NONE__POINTER_POINTER, GTK_TYPE_NONE, 2, GTK_TYPE_ADJUSTMENT, GTK_TYPE_ADJUSTMENT); - - container_class->remove = gtk_layout_remove; - container_class->forall = gtk_layout_forall; - - class->set_scroll_adjustments = gtk_layout_set_adjustments; } static void diff --git a/gtk/gtklist.c b/gtk/gtklist.c index 49739c8e4..869494a50 100644 --- a/gtk/gtklist.c +++ b/gtk/gtklist.c @@ -2410,7 +2410,7 @@ static gint gtk_list_horizontal_timeout (GtkWidget *list) { gint x, y; - GdkEventMotion event; + GdkEventMotion event = { 0 }; GdkModifierType mask; GDK_THREADS_ENTER (); @@ -2418,6 +2418,9 @@ gtk_list_horizontal_timeout (GtkWidget *list) GTK_LIST (list)->htimer = 0; gdk_window_get_pointer (list->window, &x, &y, &mask); + event.type = GDK_MOTION_NOTIFY; + event.send_event = TRUE; + event.window = NULL; event.is_hint = 0; event.x = x; event.y = y; @@ -2435,7 +2438,7 @@ gtk_list_vertical_timeout (GtkWidget *list) { gint x; gint y; - GdkEventMotion event; + GdkEventMotion event = { 0 }; GdkModifierType mask; GDK_THREADS_ENTER (); @@ -2443,6 +2446,9 @@ gtk_list_vertical_timeout (GtkWidget *list) GTK_LIST (list)->vtimer = 0; gdk_window_get_pointer (list->window, &x, &y, &mask); + event.type = GDK_MOTION_NOTIFY; + event.send_event = TRUE; + event.window = NULL; event.is_hint = 0; event.x = x; event.y = y; diff --git a/gtk/gtkstyle.c b/gtk/gtkstyle.c index f3984b9c5..3ad8976d7 100644 --- a/gtk/gtkstyle.c +++ b/gtk/gtkstyle.c @@ -563,6 +563,7 @@ GtkStyle* gtk_style_ref (GtkStyle *style) { g_return_val_if_fail (style != NULL, NULL); + g_return_val_if_fail (style->ref_count > 0, NULL); style->ref_count += 1; return style; @@ -572,6 +573,7 @@ void gtk_style_unref (GtkStyle *style) { g_return_if_fail (style != NULL); + g_return_if_fail (style->ref_count > 0); style->ref_count -= 1; if (style->ref_count == 0) diff --git a/gtk/gtktipsquery.c b/gtk/gtktipsquery.c index ccac79a18..477cfec25 100644 --- a/gtk/gtktipsquery.c +++ b/gtk/gtktipsquery.c @@ -257,6 +257,11 @@ gtk_tips_query_destroy (GtkObject *object) gtk_tips_query_set_caller (tips_query, NULL); + g_free (tips_query->label_inactive); + tips_query->label_inactive = NULL; + g_free (tips_query->label_no_tip); + tips_query->label_no_tip = NULL; + if (GTK_OBJECT_CLASS (parent_class)->destroy) (* GTK_OBJECT_CLASS (parent_class)->destroy) (object); } diff --git a/gtk/testgtk.c b/gtk/testgtk.c index 5252f3026..5cb5281fd 100644 --- a/gtk/testgtk.c +++ b/gtk/testgtk.c @@ -4645,7 +4645,7 @@ void create_ctree (void) GtkWidget *check; GtkAdjustment *adj; GtkWidget *spinner; - GdkColor transparent; + GdkColor transparent = { 0 }; char *title[] = { "Tree" , "Info" }; char buf[80]; @@ -5130,7 +5130,10 @@ void font_selection_ok (GtkWidget *w, GtkFontSelectionDialog *fs) { - g_print ("%s\n", gtk_font_selection_dialog_get_font_name (fs)); + gchar *s = gtk_font_selection_dialog_get_font_name (fs); + + g_print ("%s\n", s); + g_free (s); gtk_widget_destroy (GTK_WIDGET (fs)); } diff --git a/tests/testgtk.c b/tests/testgtk.c index 5252f3026..5cb5281fd 100644 --- a/tests/testgtk.c +++ b/tests/testgtk.c @@ -4645,7 +4645,7 @@ void create_ctree (void) GtkWidget *check; GtkAdjustment *adj; GtkWidget *spinner; - GdkColor transparent; + GdkColor transparent = { 0 }; char *title[] = { "Tree" , "Info" }; char buf[80]; @@ -5130,7 +5130,10 @@ void font_selection_ok (GtkWidget *w, GtkFontSelectionDialog *fs) { - g_print ("%s\n", gtk_font_selection_dialog_get_font_name (fs)); + gchar *s = gtk_font_selection_dialog_get_font_name (fs); + + g_print ("%s\n", s); + g_free (s); gtk_widget_destroy (GTK_WIDGET (fs)); } |