Hi,
I have been using XLOADCT in a widget program and I ran into a problem
with leaking memory. When I run XLOADCT in a widget program where the
top-level base of the widget program is the group leader for XLOADCT,
quitting the widget program while XLOADCT is running SHOULD be
seamless. However I consistently have leaking memory with the
following in the output log:
<PtrHeapVar391904>
STRUCT = -> WIDGET_BUTTON Array[1]
A short program illustrating this is listed below. To reproduce this,
run the program, press the button labeled "change colors", then press
the "quit" button on the widget program while XLOADCT is still
running. Then there should be a pointer to a structure leftover. Do
others get the same leaking memory?
Any help or thoughts would be greatly appreciated!
Rob
P.S. I am aware (and often use) XCOLORS by David Fanning in my widget
programs but I DO have a reason for using XLOADCT in this particular
case.
Robert M. Dimeo, Ph.D.
NIST Center for Neutron Research
National Institute of Standards and Technology
100 Bureau Drive - Stop 8562
Gaithersburg, MD 20899-8562
Telephone: (301) 975-8135
FAX: (301) 921-9847
www.ncnr.nist.gov/staff/dimeo
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;
pro plotData,event
winId = widget_info(event.top,find_by_uname = 'DISPLAY')
widget_control,winId,get_value = winVis
wset,winVis
tvscl,hanning(!d.x_size,!d.y_size)
end
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;
pro xloadct_test_refresh, data = data
plotData,data
end
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;
pro xloadct_test_handler,event
widget_control,event.id,get_value = val
case val[0] of
'CHANGE COLORS': $
begin
xloadct,group = event.top,updatecallback = 'xloadct_test_refresh', $
updatecbdata = event,/silent
end
'QUIT': $
begin
widget_control,event.top,/destroy
help,/heap,/brief
end
else:
endcase
end
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;
pro xloadct_test
device,decomposed = 0
loadct,4,/silent
tlb = widget_base(/col,title = 'Test of XLOADCT',mbar = bar)
rowBase = widget_base(tlb,/row)
void = widget_button(rowBase,value = 'CHANGE COLORS')
void = widget_button(rowBase,value = 'QUIT')
win = widget_draw(tlb,xsize = 400,ysize = 400,uname = 'DISPLAY')
widget_control,tlb,/realize
widget_control,win,get_value = winVis
xmanager,'xloadct_test',tlb,/no_block,event_handler =
'xloadct_test_handler'
event = {ev,id:void,top:tlb,handler:0L}
wset,winVis
plotData,event
end
|