[comp.windows.x] Can someone explain what dispatch_level is used for?

kaleb@thyme.jpl.nasa.gov (Kaleb Keithley) (03/27/91)

I'm looking at XtDestroyWidget in an application that that creates
and destroys widgets (due to the number of them) rather than manage
and unmanage.  My test program only has one widget it it, though.  I
observe a memory leak with each iteration of the create and destroy.

If I create an Athena or Motif Label on the toplevel shell, and 
subsequently destroy it, I see the following:

    -  call to Recursive(), which, on the surface, only seems to
       set w->core.being_destroyed.

    -  test app->in_phase2_destroy, it's not.

    -  build the app->destroy_list; app->dispatch_level is 1, so
       the widget in the destroy_list gets dispatch_level of 1.

    -  check if the app->dispatch_level is 0, it's not, so
       _XtDoPhase2Destroy is never called, where, I believe the
       memory allocated to the widgets in the destroy_list would 
       be free'd.

So, what is it that would set the app->dispatch_level to be 0,
and thus allow the allocated memory to be free'd in XtDestroyWidget?

-- 
Kaleb Keithley                        kaleb@thyme.jpl.nasa.gov

Meep Meep                             Roadrunner
Veep veep                             Quayle