gtk-1.2 widget destroying



I am working with gtk 1.2 and note a memory leak in my application.
This occurs from continual canvas addition to and removal from a panel (i.e. widget creating & destroying.)

History of events looks like ...

canvas creation:

	 drawingArea = gtk_drawing_area_new ();
	 eventBox = gtk_event_box_new ();
	 gtk_container_add (GTK_CONTAINER(eventBox), drawingArea);
        /* make Canvas focusable */
	GTK_WIDGET_SET_FLAGS(eventBox, GTK_CAN_FOCUS);
	gtk_widget_show (drawingArea);
	gtk_widget_show (eventBox);

canvas insertion to panel calls the following gtk APIs:

                gtk_widget_set_parent (eventBox, GTK_WIDGET (panel));
		...
                gtk_widget_realize (eventBox);
		...
		gtk_widget_map (eventBox);
		...
                gtk_widget_queue_resize (GTK_WIDGET (panel));
	
canvas destroy:
		/*In case any floating references held*/
		gtk_object_sink (eventBox);	
		gtk_widget_destroy (eventBox);

This destroy instantiates customized removal from panel which calls:

			gtk_widget_unparent (widget);

                        gtk_widget_queue_resize (GTK_WIDGET(container));


Am I missing something in order to ensure total widget object resource freeing ?

Questions:
- Can I query if any references are held to an object ?
- If so, can I query who holds them ?


Thanks,
Ronan





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]