Fix error in computing length and a memory leak. (Fixes #94072, reported

Thu Oct  3 19:00:55 2002  Owen Taylor  <otaylor@redhat.com>

        * gdk/x11/gdkselection-x11.c (gdk_selection_property_get):
        Fix error in computing length and a memory leak.
        (Fixes #94072, reported by Hema Seetharamaiah)

        * gtk/gtkmenu.c (gtk_menu_motion_notify): Fix &event
        used instead of event.
This commit is contained in:
Owen Taylor 2002-10-03 23:23:16 +00:00 committed by Owen Taylor
parent 12359a817b
commit 92fa223146
9 changed files with 95 additions and 21 deletions

View File

@ -1,3 +1,12 @@
Thu Oct 3 19:00:55 2002 Owen Taylor <otaylor@redhat.com>
* gdk/x11/gdkselection-x11.c (gdk_selection_property_get):
Fix error in computing length and a memory leak.
(Fixes #94072, reported by Hema Seetharamaiah)
* gtk/gtkmenu.c (gtk_menu_motion_notify): Fix &event
used instead of event.
2002-10-04 Matthias Clasen <maclas@gmx.de>
* demos/gtk-demo/main.c (main):

View File

@ -1,3 +1,12 @@
Thu Oct 3 19:00:55 2002 Owen Taylor <otaylor@redhat.com>
* gdk/x11/gdkselection-x11.c (gdk_selection_property_get):
Fix error in computing length and a memory leak.
(Fixes #94072, reported by Hema Seetharamaiah)
* gtk/gtkmenu.c (gtk_menu_motion_notify): Fix &event
used instead of event.
2002-10-04 Matthias Clasen <maclas@gmx.de>
* demos/gtk-demo/main.c (main):

View File

@ -1,3 +1,12 @@
Thu Oct 3 19:00:55 2002 Owen Taylor <otaylor@redhat.com>
* gdk/x11/gdkselection-x11.c (gdk_selection_property_get):
Fix error in computing length and a memory leak.
(Fixes #94072, reported by Hema Seetharamaiah)
* gtk/gtkmenu.c (gtk_menu_motion_notify): Fix &event
used instead of event.
2002-10-04 Matthias Clasen <maclas@gmx.de>
* demos/gtk-demo/main.c (main):

View File

@ -1,3 +1,12 @@
Thu Oct 3 19:00:55 2002 Owen Taylor <otaylor@redhat.com>
* gdk/x11/gdkselection-x11.c (gdk_selection_property_get):
Fix error in computing length and a memory leak.
(Fixes #94072, reported by Hema Seetharamaiah)
* gtk/gtkmenu.c (gtk_menu_motion_notify): Fix &event
used instead of event.
2002-10-04 Matthias Clasen <maclas@gmx.de>
* demos/gtk-demo/main.c (main):

View File

@ -1,3 +1,12 @@
Thu Oct 3 19:00:55 2002 Owen Taylor <otaylor@redhat.com>
* gdk/x11/gdkselection-x11.c (gdk_selection_property_get):
Fix error in computing length and a memory leak.
(Fixes #94072, reported by Hema Seetharamaiah)
* gtk/gtkmenu.c (gtk_menu_motion_notify): Fix &event
used instead of event.
2002-10-04 Matthias Clasen <maclas@gmx.de>
* demos/gtk-demo/main.c (main):

View File

@ -1,3 +1,12 @@
Thu Oct 3 19:00:55 2002 Owen Taylor <otaylor@redhat.com>
* gdk/x11/gdkselection-x11.c (gdk_selection_property_get):
Fix error in computing length and a memory leak.
(Fixes #94072, reported by Hema Seetharamaiah)
* gtk/gtkmenu.c (gtk_menu_motion_notify): Fix &event
used instead of event.
2002-10-04 Matthias Clasen <maclas@gmx.de>
* demos/gtk-demo/main.c (main):

View File

@ -295,35 +295,54 @@ gdk_selection_property_get (GdkWindow *requestor,
*ret_type = gdk_x11_xatom_to_atom_for_display (display, prop_type);
if (ret_format)
*ret_format = prop_format;
/* Add on an extra byte to handle null termination. X guarantees
that t will be 1 longer than nitems and null terminated */
length = nitems + 1;
if (data)
if (prop_type == XA_ATOM ||
prop_type == gdk_x11_get_xatom_by_name_for_display (display, "ATOM_PAIR"))
{
*data = g_new (guchar, length);
if (prop_type == XA_ATOM ||
prop_type == gdk_x11_get_xatom_by_name_for_display (display, "ATOM_PAIR"))
Atom* atoms = (Atom*) t;
GdkAtom* atoms_dest;
gint num_atom, i;
if (prop_format != 32)
goto err;
num_atom = nitems;
length = sizeof (GdkAtom) * num_atom + 1;
if (data)
{
Atom* atoms = (Atom*) t;
GdkAtom* atoms_dest;
gint num_atom, i;
num_atom = (length - 1) / sizeof (Atom);
length = sizeof (GdkAtom) * num_atom + 1;
*data = g_malloc (length);
(*data)[length - 1] = '\0';
atoms_dest = (GdkAtom *)(*data);
for (i=0; i < num_atom; i++)
atoms_dest[i] = gdk_x11_xatom_to_atom_for_display (display, atoms[i]);
}
else
}
else
{
switch (prop_format)
{
*data = g_memdup (t, length);
case 8:
length = nitems;
break;
case 16:
length = sizeof(short) * nitems;
break;
case 32:
length = sizeof(long) * nitems;
break;
default:
g_assert_not_reached ();
break;
}
/* Add on an extra byte to handle null termination. X guarantees
that t will be 1 longer than nitems and null terminated */
length += 1;
if (data)
*data = g_memdup (t, length);
}
if (t)

View File

@ -1982,7 +1982,6 @@ gtk_menu_motion_notify (GtkWidget *widget,
GdkEvent *send_event = gdk_event_new (GDK_ENTER_NOTIFY);
gboolean result;
send_event->crossing.type = GDK_ENTER_NOTIFY;
send_event->crossing.window = g_object_ref (event->window);
send_event->crossing.time = event->time;
send_event->crossing.send_event = TRUE;
@ -1997,7 +1996,7 @@ gtk_menu_motion_notify (GtkWidget *widget,
* menuitem is a child of the active menu or some parent
* menu of the active menu.
*/
result = gtk_widget_event (widget, &send_event);
result = gtk_widget_event (widget, send_event);
gdk_event_free (send_event);
return result;

View File

@ -1715,9 +1715,11 @@ create_buffer (void)
++i;
}
#if 0
buffer->invisible_tag = gtk_text_buffer_create_tag (buffer->buffer, NULL,
"invisible", TRUE, NULL);
#endif
buffer->not_editable_tag =
gtk_text_buffer_create_tag (buffer->buffer, NULL,