Commit feca5a64 authored by Owen Taylor's avatar Owen Taylor Committed by Owen Taylor

Ref and sink priv->tooltips in init() and unref priv->tooltips in destroy

Tue Dec  4 12:06:13 2001  Owen Taylor  <otaylor@redhat.com>
	* gtk/gtkcolorsel.c: Ref and sink priv->tooltips in
	init() and unref priv->tooltips in destroy rather
	than calling gtk_object_destroy() which has no
	effect on memory management. (#66104, HideToshi
	Tajima)
	* gtk/gtkcolorsel.c (palette_set_color): Use g_object_set_data_full()
	so we free the when the object is freed. (Fixes memory
	leak, #66096, HideToshi Tajima)
	* gdk/gdkevents.c (gdk_synthesize_window_state): Use
	a full GdkEvent structure to avoid reads of uninitialized/
	invalid memory in gdk_event_put() (#65877, patch
	from Hidetoshi Tajima)
parent 76030813
Tue Dec 4 12:06:13 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtkcolorsel.c: Ref and sink priv->tooltips in
init() and unref priv->tooltips in destroy rather
than calling gtk_object_destroy() which has no
effect on memory management. (#66104, HideToshi
Tajima)
* gtk/gtkcolorsel.c (palette_set_color): Use g_object_set_data_full()
so we free the when the object is freed. (Fixes memory
leak, #66096, HideToshi Tajima)
* gdk/gdkevents.c (gdk_synthesize_window_state): Use
a full GdkEvent structure to avoid reads of uninitialized/
invalid memory in gdk_event_put() (#65877, patch
from Hidetoshi Tajima)
Tue Dec 4 11:06:54 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtkmenuitem.c: Revert my last mistaken change -
......
Tue Dec 4 12:06:13 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtkcolorsel.c: Ref and sink priv->tooltips in
init() and unref priv->tooltips in destroy rather
than calling gtk_object_destroy() which has no
effect on memory management. (#66104, HideToshi
Tajima)
* gtk/gtkcolorsel.c (palette_set_color): Use g_object_set_data_full()
so we free the when the object is freed. (Fixes memory
leak, #66096, HideToshi Tajima)
* gdk/gdkevents.c (gdk_synthesize_window_state): Use
a full GdkEvent structure to avoid reads of uninitialized/
invalid memory in gdk_event_put() (#65877, patch
from Hidetoshi Tajima)
Tue Dec 4 11:06:54 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtkmenuitem.c: Revert my last mistaken change -
......
Tue Dec 4 12:06:13 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtkcolorsel.c: Ref and sink priv->tooltips in
init() and unref priv->tooltips in destroy rather
than calling gtk_object_destroy() which has no
effect on memory management. (#66104, HideToshi
Tajima)
* gtk/gtkcolorsel.c (palette_set_color): Use g_object_set_data_full()
so we free the when the object is freed. (Fixes memory
leak, #66096, HideToshi Tajima)
* gdk/gdkevents.c (gdk_synthesize_window_state): Use
a full GdkEvent structure to avoid reads of uninitialized/
invalid memory in gdk_event_put() (#65877, patch
from Hidetoshi Tajima)
Tue Dec 4 11:06:54 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtkmenuitem.c: Revert my last mistaken change -
......
Tue Dec 4 12:06:13 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtkcolorsel.c: Ref and sink priv->tooltips in
init() and unref priv->tooltips in destroy rather
than calling gtk_object_destroy() which has no
effect on memory management. (#66104, HideToshi
Tajima)
* gtk/gtkcolorsel.c (palette_set_color): Use g_object_set_data_full()
so we free the when the object is freed. (Fixes memory
leak, #66096, HideToshi Tajima)
* gdk/gdkevents.c (gdk_synthesize_window_state): Use
a full GdkEvent structure to avoid reads of uninitialized/
invalid memory in gdk_event_put() (#65877, patch
from Hidetoshi Tajima)
Tue Dec 4 11:06:54 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtkmenuitem.c: Revert my last mistaken change -
......
Tue Dec 4 12:06:13 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtkcolorsel.c: Ref and sink priv->tooltips in
init() and unref priv->tooltips in destroy rather
than calling gtk_object_destroy() which has no
effect on memory management. (#66104, HideToshi
Tajima)
* gtk/gtkcolorsel.c (palette_set_color): Use g_object_set_data_full()
so we free the when the object is freed. (Fixes memory
leak, #66096, HideToshi Tajima)
* gdk/gdkevents.c (gdk_synthesize_window_state): Use
a full GdkEvent structure to avoid reads of uninitialized/
invalid memory in gdk_event_put() (#65877, patch
from Hidetoshi Tajima)
Tue Dec 4 11:06:54 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtkmenuitem.c: Revert my last mistaken change -
......
Tue Dec 4 12:06:13 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtkcolorsel.c: Ref and sink priv->tooltips in
init() and unref priv->tooltips in destroy rather
than calling gtk_object_destroy() which has no
effect on memory management. (#66104, HideToshi
Tajima)
* gtk/gtkcolorsel.c (palette_set_color): Use g_object_set_data_full()
so we free the when the object is freed. (Fixes memory
leak, #66096, HideToshi Tajima)
* gdk/gdkevents.c (gdk_synthesize_window_state): Use
a full GdkEvent structure to avoid reads of uninitialized/
invalid memory in gdk_event_put() (#65877, patch
from Hidetoshi Tajima)
Tue Dec 4 11:06:54 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtkmenuitem.c: Revert my last mistaken change -
......
Tue Dec 4 12:06:13 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtkcolorsel.c: Ref and sink priv->tooltips in
init() and unref priv->tooltips in destroy rather
than calling gtk_object_destroy() which has no
effect on memory management. (#66104, HideToshi
Tajima)
* gtk/gtkcolorsel.c (palette_set_color): Use g_object_set_data_full()
so we free the when the object is freed. (Fixes memory
leak, #66096, HideToshi Tajima)
* gdk/gdkevents.c (gdk_synthesize_window_state): Use
a full GdkEvent structure to avoid reads of uninitialized/
invalid memory in gdk_event_put() (#65877, patch
from Hidetoshi Tajima)
Tue Dec 4 11:06:54 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtkmenuitem.c: Revert my last mistaken change -
......
......@@ -941,23 +941,23 @@ gdk_synthesize_window_state (GdkWindow *window,
GdkWindowState unset_flags,
GdkWindowState set_flags)
{
GdkEventWindowState temp_event;
GdkEvent temp_event;
GdkWindowState old;
g_return_if_fail (window != NULL);
temp_event.window = window;
temp_event.type = GDK_WINDOW_STATE;
temp_event.send_event = FALSE;
temp_event.window_state.window = window;
temp_event.window_state.type = GDK_WINDOW_STATE;
temp_event.window_state.send_event = FALSE;
old = ((GdkWindowObject*) temp_event.window)->state;
old = ((GdkWindowObject*) temp_event.window_state.window)->state;
temp_event.changed_mask = (unset_flags | set_flags) ^ old;
temp_event.new_window_state = old;
temp_event.new_window_state |= set_flags;
temp_event.new_window_state &= ~unset_flags;
temp_event.window_state.changed_mask = (unset_flags | set_flags) ^ old;
temp_event.window_state.new_window_state = old;
temp_event.window_state.new_window_state |= set_flags;
temp_event.window_state.new_window_state &= ~unset_flags;
if (temp_event.new_window_state == old)
if (temp_event.window_state.new_window_state == old)
return; /* No actual work to do, nothing changed. */
/* Actually update the field in GdkWindow, this is sort of an odd
......@@ -965,7 +965,7 @@ gdk_synthesize_window_state (GdkWindow *window,
* inconsistent state to the user.
*/
((GdkWindowObject*) window)->state = temp_event.new_window_state;
((GdkWindowObject*) window)->state = temp_event.window_state.new_window_state;
/* We only really send the event to toplevels, since
* all the window states don't apply to non-toplevels.
......@@ -977,7 +977,7 @@ gdk_synthesize_window_state (GdkWindow *window,
case GDK_WINDOW_TOPLEVEL:
case GDK_WINDOW_DIALOG:
case GDK_WINDOW_TEMP: /* ? */
gdk_event_put ((GdkEvent*) &temp_event);
gdk_event_put (&temp_event);
break;
case GDK_WINDOW_FOREIGN:
......
......@@ -793,7 +793,6 @@ palette_set_color (GtkWidget *drawing_area,
gdouble *color)
{
gdouble *new_color = g_new (double, 4);
gdouble *old_color;
GdkColor gdk_color;
gdk_color.red = UNSCALE (color[0]);
......@@ -823,20 +822,13 @@ palette_set_color (GtkWidget *drawing_area,
gtk_object_set_data (GTK_OBJECT (drawing_area), "color_set", GINT_TO_POINTER (1));
}
else
{
old_color = (gdouble *) gtk_object_get_data (GTK_OBJECT (drawing_area), "color_val");
if (old_color)
{
g_free (old_color);
}
}
new_color[0] = color[0];
new_color[1] = color[1];
new_color[2] = color[2];
new_color[3] = 1.0;
gtk_object_set_data (GTK_OBJECT (drawing_area), "color_val", new_color);
g_object_set_data_full (G_OBJECT (drawing_area), "color_val", new_color, (GDestroyNotify)g_free);
}
static gboolean
......@@ -1762,6 +1754,8 @@ gtk_color_selection_init (GtkColorSelection *colorsel)
priv->default_alpha_set = FALSE;
priv->tooltips = gtk_tooltips_new ();
g_object_ref (priv->tooltips);
gtk_object_sink (GTK_OBJECT (priv->tooltips));
gtk_box_set_spacing (GTK_BOX (colorsel), 4);
top_hbox = gtk_hbox_new (FALSE, 8);
......@@ -1924,7 +1918,7 @@ gtk_color_selection_destroy (GtkObject *object)
if (priv->tooltips)
{
gtk_object_destroy (GTK_OBJECT (priv->tooltips));
g_object_unref (priv->tooltips);
priv->tooltips = NULL;
}
......
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