GtkPlug issue ...



Hi there,

	I'm having a rather evil issue - that we've seen before with the
correct freeing of Gdk resources associated with plug / sockets. Last time
the fix was to hoist the unrealize chaining above the local releasing of
the plug / socket resources in the plug->unrealize handler.

	I assume this had the effect of ensuring that widget->window was
freed before it's parent was. Either way; even having done that I get a
strack trace a little like this:

(gdb) bt
#0  _gdk_window_destroy_hierarchy (window=0x460befac, recursing=0,
foreign_destroy=0) at gdkwindow.c:308
#1  0x40305f63 in gdk_window_destroy (window=0x460befac) at
gdkwindow.c:404
#2  0x4025dbd9 in gtk_widget_real_unrealize (widget=0x460a0f5c) at
gtkwidget.c:5479
#3  0x40264379 in gtk_window_unrealize (widget=0x460a0f5c) at
gtkwindow.c:3177
#4  0x40268214 in gtk_plug_unrealize (widget=0x460a0f5c) at gtkplug.c:367
#5  0x40759d6e in g_cclosure_marshal_VOID__VOID (closure=0x41a74ff0,
return_value=0x0, n_param_values=1, param_values=0xbfffedc0,
    invocation_hint=0xbfffecc0, marshal_data=0x40268148) at gmarshal.c:32
#6  0x407461cb in g_type_class_meta_marshal (closure=0x41a74ff0,
return_value=0x0, n_param_values=1, param_values=0xbfffedc0,
    invocation_hint=0xbfffecc0, marshal_data=0x58) at gclosure.c:513
#7  0x40745dce in g_closure_invoke (closure=0x41a74ff0, return_value=0x0,
n_param_values=1, param_values=0xbfffedc0, invocation_hint=0xbfffecc0)
    at gclosure.c:436
#8  0x407593a4 in signal_emit_unlocked_R (node=0x41a7afd8, detail=0,
instance=0x460a0f5c, emission_return=0x0, instance_and_params=0xbfffedc0)
    at gsignal.c:2157
#9  0x40757822 in g_signal_emit_valist (instance=0x460a0f5c, signal_id=13,
detail=0, var_args=0xbffff048) at gsignal.c:1883
#10 0x401d5bb5 in gtk_signal_emit (object=0x460a0f5c, signal_id=13) at
gtksignal.c:357
#11 0x40256ff5 in gtk_widget_unrealize (widget=0x460a0f5c) at
gtkwidget.c:1954
#12 0x4025d5f4 in gtk_widget_dispose (object=0x460a0f5c) at
gtkwidget.c:5314
#13 0x40261892 in gtk_window_dispose (object=0x460a0f5c) at
gtkwindow.c:1374
#14 0x40747d85 in g_object_run_dispose (object=0x460a0f5c) at
gobject.c:469
#15 0x401b2976 in gtk_object_destroy (object=0x460a0f5c) at
gtkobject.c:357
#16 0x40256379 in gtk_widget_destroy (widget=0x460a0f5c) at
gtkwidget.c:1592
#17 0x402691f7 in gtk_plug_filter_func (gdk_xevent=0xbffff2f0,
event=0x418fc018, data=0x460a0f5c) at gtkplug.c:1088
#18 0x40313c4f in gdk_event_apply_filters (xevent=0xbffff2f0,
event=0x418fc018, filters=0x40d54ae8) at gdkevents-x11.c:267
#19 0x403141ab in gdk_event_translate (event=0x418fc018,
xevent=0xbffff2f0, return_exposes=0) at gdkevents-x11.c:531
#20 0x40315d81 in _gdk_events_queue () at gdkevents-x11.c:1691
#21 0x40315f52 in gdk_event_dispatch (source=0x41376fd4, callback=0,
user_data=0x0) at gdkevents-x11.c:1747
#22 0x407ba8ea in g_main_dispatch (context=0x40ec5f7c) at gmain.c:1616
#23 0x407bb219 in g_main_context_dispatch (context=0x40ec5f7c) at
gmain.c:2151
#24 0x407bb5b4 in g_main_context_iterate (context=0x40ec5f7c, block=0,
dispatch=1, self=0x40e88fdc) at gmain.c:2232
#25 0x407bb72b in g_main_context_iteration (context=0x0, may_block=0) at
gmain.c:2291
#26 0x400378d0 in process_events (servant=0x424eafe8) at
bonobo-control.c:455
#27 0x405a198b in _ORBIT_skel_small_Bonobo_Control_unrealize
(_o_servant=0x424eafe8, _o_retval=0x0, _o_args=0x0, _o_ctx=0xbffff560,
_o_ev=0xbffff640,
    _impl_unrealize=0x400378fc <impl_Bonobo_Control_unrealize>) at
Bonobo-skels.c:1584
#28 0x4063052c in ORBit_POAObject_invoke (pobj=0x45f7efe0, ret=0x0,
args=0x0, ctx=0xbffff560, data=0xbffff5d8, ev=0xbffff640) at poa.c:1002
#29 0x406320ef in ORBit_OAObject_invoke (adaptor_obj=0x45f7efe0, ret=0x0,
args=0x0, ctx=0xbffff560, data=0xbffff5d8, ev=0xbffff640)
    at orbit-adaptor.c:81
#30 0x40624f9f in ORBit_small_invoke_adaptor (adaptor_obj=0x45f7efe0,
recv_buffer=0x45f21f98, m_data=0x405b7844, data=0xbffff5d8, ev=0xbffff640)
    at orbit-small.c:784
#31 0x40630905 in ORBit_POAObject_handle_request (pobj=0x45f7efe0,
opname=0x45f23fd8 "unrealize", ret=0x0, args=0x0, ctx=0x0,
recv_buffer=0x45f21f98,
    ev=0xbffff640) at poa.c:1168
#32 0x40630b2d in ORBit_POA_handle_request (poa=0x40c93f8c,
recv_buffer=0x45f21f98, objkey=0x45f21fb0) at poa.c:1242
#33 0x4063207a in ORBit_handle_request (orb=0x40c8ffd4,
recv_buffer=0x45f21f98) at orbit-adaptor.c:44
#34 0x4061f088 in giop_connection_handle_input (lcnx=0x42042fbc) at
giop-connection.c:155
#35 0x4064e4d1 in linc_connection_connected (gioc=0x45ed4fc8,
condition=G_IO_IN, data=0x42042fbc) at linc-connection.c:84
#36 0x407d6b37 in g_io_unix_dispatch (source=0x45edefc0,
callback=0x4064e444 <linc_connection_connected>, user_data=0x42042fbc) at
giounix.c:159
#37 0x407ba8ea in g_main_dispatch (context=0x40ec5f7c) at gmain.c:1616
#38 0x407bb219 in g_main_context_dispatch (context=0x40ec5f7c) at
gmain.c:2151
#39 0x407bb5b4 in g_main_context_iterate (context=0x40ec5f7c, block=1,
dispatch=1, self=0x40e88fdc) at gmain.c:2232
#40 0x407bbc5e in g_main_loop_run (loop=0x418efff4) at gmain.c:2452
#41 0x4058d096 in bonobo_main () at bonobo-main.c:234
#42 0x080490f7 in main (argc=1, argv=0xbffff8ec) at
bonobo-sample-controls.c:81
#43 0x408c7177 in __libc_start_main (main=0x804909c <main>, argc=1,
ubp_av=0xbffff8ec, init=0x8048be0 <_init>, fini=0x8049140 <_fini>,
    rtld_fini=0x4000e184 <_dl_fini>, stack_end=0xbffff8dc) at
../sysdeps/generic/libc-start.c:129


(gdb) p *(GdkWindowObject *)window
$3 = {parent_instance = {parent_instance = {g_type_instance = {g_class =
0x4134cf78}, ref_count = 5, qdata = 0x40d4a9c8}}, impl = 0x460c0fa8,
  parent = 0x424e4fac, user_data = 0x0, x = 0, y = 0, extension_events =
0, filters = 0x40d54ae8, children = 0x0, bg_color = {pixel = 54970,
    red = 54998, green = 54998, blue = 54998}, bg_pixmap = 0x0,
paint_stack = 0x0, update_area = 0x0, update_freeze_count = 0,
  window_type = 1 '\001', depth = 16 '\020', resize_count = 0 '\000',
state = 3, guffaw_gravity = 0, input_only = 0, modal_hint = 0, destroyed =
0}

(gdb) p *(GdkWindowObject *)$3.parent
$4 = {parent_instance = {parent_instance = {g_type_instance = {g_class =
0xaaaaaaaa}, ref_count = 2863311530, qdata = 0xaaaaaaaa}},
  impl = 0xaaaaaaaa, parent = 0xaaaaaaaa, user_data = 0xaaaaaaaa, x =
-1431655766, y = -1431655766, extension_events = -1431655766,
  filters = 0xaaaaaaaa, children = 0xaaaaaaaa, bg_color = {pixel =
2863311530, red = 43690, green = 43690, blue = 43690}, bg_pixmap =
0xaaaaaaaa,
  paint_stack = 0xaaaaaaaa, update_area = 0xaaaaaaaa, update_freeze_count
= 2863311530, window_type = 170 'ª', depth = 170 'ª',
  resize_count = 170 'ª', state = 2863311530, guffaw_gravity = 0,
input_only = 1, modal_hint = 0, destroyed = 1}

	So ... This (strangely) happpens only on the 2nd attempt - most
odd. It can be reproduced by running
libbonoboui/samples/controls/bonobo-sample-controls-2 and then test-focus
(+ delete_event) twice.

	By adding debug to various places, I ascertain that the path that
causes the issue seems to via:

		_gdk_window_destroy_hierarchy

	With the following added:

	  if (GDK_WINDOW_TYPE (window) != GDK_WINDOW_FOREIGN)
		...
	  else
		  g_warning ("Leaving poison children on '%p' eg. '%p'",
			     window, private->children ?
		             private->children->data : NULL);

	I get:

lt-bonobo-sample-controls-2 (pid:17582): Gdk-WARNING **: Leaving poison
children on '0x424e4fac' eg. '0x460befac'

	(gdb) p (GdkWindowObject *)$3.parent
		$5 = (GdkWindowObject *) 0x424e4fac

	ie. we release the parent, but leave the children pointing to it.

	So - my question is: why; I mean, if we have created some children
of a foreign window, perhaps we don't want to go round doing a violence to
them if the parent dies ( though probably we do ). But we should at least
not leave stale parent pointers lying around in them; should there not be
a little loop over the children here, unparenting them ?

	Many thanks,

		Michael.

-- 
 mmeeks gnu org  <><, Pseudo Engineer, itinerant idiot




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