window leaks from gtk_drag_set_icon_widget()
- From: Tim Janik <timj gtk org>
- To: Owen Taylor <otaylor gtk org>
- cc: Gtk+ Developers <gtk-devel-list redhat com>
- Subject: window leaks from gtk_drag_set_icon_widget()
- Date: Wed, 10 Feb 1999 09:03:45 +0100 (CET)
hi owen,
you might have noticed (assuming you have export GTK_DEBUG=objects in
your .profile ;) that most DnD operations leak winodws with ref counts
of 1.
this is due to code similar to
static void
gtk_color_selection_drag_begin (GtkWidget *widget,
GdkDragContext *context,
gpointer data)
{
[...]
window = gtk_window_new (GTK_WINDOW_POPUP);
[...]
gtk_drag_set_icon_widget (context, window, -2, -2);
/* i.e. set and forget about the window */
}
for the colorselection, i just hooked up a drag_end handler that will
care about the window's destruction, so at least the colorselection
doesn't leak windows anymore.
a bunch of other code that does similar things in their drag_begin
handler probably needs to be adapted to care about the destruction
as well.
but given that the DnD internals do the same thing in
gtk_drag_set_icon_pixmap(), i'd rather see us taking a different path,
i.e.
introduce
/* Set the image window being dragged around, the window will
* be auto-destructed at the end of the drag.
*/
void gtk_drag_set_icon_window (GdkDragContext *context,
GtkWidget *widget,
gint hot_x,
gint hot_y);
which will auto-destroy the window in gtk_drag_remove_icon().
if people want to keep around the window for further drag operations,
they can still use gtk_drag_set_icon_widget(). for a related matter,
does it make sense at all to pass anything else than a window widget
into gtk_drag_set_icon_widget? i presume not, and so we should probably
add an appropriate g_return_if_fail statement.
---
ciaoTJ
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]