Re: Phix+EuGTK
- Posted by irv Jan 28, 2021
- 1791 views
Ok, this is strange. I had to devise a test to see what is going on. I created a simple window with a label and a button. Click the button, and a dialog pops up. Here's what happens:
"---------- BEFORE ------------" hdict before: {24327152,26215072,26239360,26284368,26325424} 1 24327152 -> {"struct","Label",11,1} 2 26215072 -> {"struct","Window",7,1} 3 26239360 -> {"struct","Button",15,1} 4 26284368 -> {"struct","ButtonBox",12,1} 5 26325424 -> {"struct","Box",9,1} "----------- DIALOG CREATED ------------" hdict before: {24327152,26215072,26239360,26284368,26325424} hdict now: {24327152,24328400,24328800,26215072,26239360,26284368,26325424,26325776,28222240} 1 24327152 -> {"struct","Label",11,1} 2 24328400 -> {"struct","Label",11,2} 3 24328800 -> {"struct","Expander",18,1} 4 26215072 -> {"struct","Window",7,1} 5 26239360 -> {"struct","Button",15,1} 6 26284368 -> {"struct","ButtonBox",12,1} 7 26325424 -> {"struct","Box",9,1} 8 26325776 -> {"struct","Box",9,2} 9 28222240 -> {"struct","MessageDialog",17,1} "********** DIALOG CLOSED **************" Deleting Label 24328400 {"struct","Label",11,2} Deleting Box 26325776 {"struct","Box",9,2} Deleting Expander 24328800 {"struct","Expander",18,1} Deleting Message Dialog 28222240 {"struct","MessageDialog",17,1} "========== AFTER =============" hdict at start: {24327152,26215072,26239360,26284368,26325424} hdict now: {24327152,26215072,26239360,26284368,26325424} 1 24327152 -> {"struct","Label",11,1} 2 26215072 -> {"struct","Window",7,1} 3 26239360 -> {"struct","Button",15,1} 4 26284368 -> {"struct","ButtonBox",12,1} 5 26325424 -> {"struct","Box",9,1}
So far, so good, the Before and After match, just as it should be. Now for another run, and a different outcome:
"---------- BEFORE ------------" hdict before: {23229424,25060000,25395632,25436496,25477504} 1 23229424 -> {"struct","Label",11,1} 2 25060000 -> {"struct","Window",7,1} 3 25395632 -> {"struct","Box",9,1} 4 25436496 -> {"struct","ButtonBox",12,1} 5 25477504 -> {"struct","Button",15,1} "----------- DIALOG CREATED ------------" hdict before: {23229424,25060000,25395632,25436496,25477504} hdict now: {23229424,23230672,23231072,25060000,25395632,25395984,25436496,25477504,27124512} 1 23229424 -> {"struct","Label",11,1} 2 23230672 -> {"struct","Label",11,2} 3 23231072 -> {"struct","Expander",18,1} 4 25060000 -> {"struct","Window",7,1} 5 25395632 -> {"struct","Box",9,1} 6 25395984 -> {"struct","Box",9,2} 7 25436496 -> {"struct","ButtonBox",12,1} 8 25477504 -> {"struct","Button",15,1} 9 27124512 -> {"struct","MessageDialog",17,1} "********** DIALOG CLOSED **************" Deleting Label 23230672 {"struct","Label",11,2} Deleting Box 25395984 {"struct","Box",9,2} Deleting Expander 23231072 {"struct","Expander",18,1} Deleting Message Dialog 27124512 {"struct","MessageDialog",17,1} "========== AFTER =============" hdict at start: {23229424,25060000,25395632,25436496,25477504} hdict now: {23229424,25060000,25395632,25436496,25477504} 1 23229424 -> {"struct","Label",11,1} 2 25060000 -> {"struct","Label",11,2} -- NOTE: this is the "handle" previously assigned to the main window. 3 25395632 -> {"struct","Box",9,1} 4 25436496 -> {"struct","ButtonBox",12,1} 5 25477504 -> {"struct","Button",15,1} ?? where's my window gone ??
With no change to my program, every run comes out different, with something not deleted that should have been, and something deleted that should not have been. Sometimes it works properly. Sometimes isn't good enough. What to do?
The delete routine for each of the widgets is similar to this one:
procedure ~Label() --(replacing Label here and below with the appropriate class name) printf(1,"Deleting Label %d ",this.handle) ? this deld(this.handle,hdict) this.destroy() end procedure