Re: Phix+EuGTK
- Posted by irv Jan 29, 2021
- 2253 views
Great! That seems to have fixed the problem. Testing will continue.
Deleting Label 13712400 {"struct","Label",11,2}
Deleting Box 15661136 {"struct","Box",9,2}
Deleting Expander 13712800 {"struct","Expander",18,1}
Deleting Message Dialog 17613600 {"struct","MessageDialog",17,1}
"========== AFTER ============="
hdict at start: {13710320,15615152,15659376,15991168,15991616,15992064,17384032}
hdict now: {13710320,15615152,15659376,15991168,15991616,15992064,17384032}
1 13710320 -> {"struct","Label",11,1}
2 15615152 -> {"struct","ButtonBox",12,1}
3 15659376 -> {"struct","Box",9,1}
4 15991168 -> {"struct","Button",15,1}
5 15991616 -> {"struct","Button",15,2}
6 15992064 -> {"struct","Button",15,3}
7 17384032 -> {"struct","Window",7,1}
All correct, and seems repeatable regardless of the order in which controls are added.
-- just out of curiosity, I then add: ? bx ? ans ? dlg
Results:
{"struct","Box",9,2}
{"struct","Label",11,2}
{"struct","MessageDialog",17,1}
If I try to access the handle of a deleted control:
? bx.handle
I get a crash (as expected), since it's been deleted:
/usr/local/bin/builtins/structs.e:1110 in function fetch_field()
type check failure, s is {"struct","Box",9,2}
s = {"struct","Box",9,2}
field_name = "handle"
context = 0
sdx = <novalue>
stype = <novalue>
fdx = <novalue>
cdii = <novalue>
getter = <novalue>
flags = <novalue>
getfn = <novalue>
maxp = <novalue>
minp = <novalue>
It seems possible that some code might someday try to access a field of a deleted instance, and crash. Is there a better way to prevent a crash than using, for example:
try ? dlg.handle catch e ? "It's dead, Jim" end try

