David, thanks for the response. This is exactly what I needed!
David Fanning <david@dfanning.com> wrote in message news:<MPG.1886302a1f6b8dbc989a9a@news.frii.com>...
> The problem is that XLOADCT cleans up after itself if
> you hit the DONE button, but not otherwise. This is
> *exactly* why widget programs need CLEANUP routines that
> get called when programs die! :-)
>
> This problem is even more pernicious, since the pointer
> that needs to get cleaned up is in a Common block, so you
> can't even free it up with HEAP_GC!
>
> Here is a cleanup routine for XLOADCT:
>
> ;*********************************************************
> PRO xloadct_cleanup, id
> COMMON colors, r_orig, g_orig, b_orig, r_curr, g_curr, b_curr
> COMMON xloadct_com, r0, g0, b0, tfun, state, filename, cps, psave, pnt,
> $
> top, bot, silent, chop, lock, g_lbl, vbot, vtop, g_slider, $
> gamma, color, use_values, ncolors, cbot, siz, w_height, show_win, $
> updt_callback, p_updt_cb_data
> if PTR_VALID(p_updt_cb_data) then PTR_FREE, p_updt_cb_data
> END
> ;*********************************************************
>
>
> Assign it like this:
>
> XManager, "xloadct", base, NO_BLOCK=(NOT(FLOAT(block))), $
> Cleanup='xloadct_cleanup'
>
>
> That should do it. :-)
>
> Cheers,
>
> David
|