Gadgets.Insert BasicGadgets.NewButton to Insert a button somewhere. Then I execute System.Free BasicGadgets~ makes the system freeze...
Felix wrote: Don't be so cruel to the poor Button. You have stolen its Handler. ;-) Seriously: The Problem is: When freeing a Module, Oberon checks if there are still other Modules depending on that module but it cannot check if Objects are still using any Allocated Memory in that Module. In that special case the allocated Memory was the Handler and moreover any type-checks and type-casts could't work since the Module did not exist any more (after successful freeing it) etc.
So the "solution" is: Do not System.Free a Module when its Objects are still displayed, since they are not deallocated and the Handler is called any time a Display.Broadcast (or update message) is sent (which is the case when new Viewers like a Trap-View are opened.)
Felix.
Thanks for the info. I see the problem. However, in several years of working with Oberon, I have only found three ways to produce C-like system freezes apart from using the unsafe SYSTEM feature: A) calling C programs from within Oberon B) passing very large arrays as value parameters in procedure headings C) unloading modules whereby some visual gadget is still hanging around somewhere, as mentioned above. I feel system stability is a prominent one of the many highlights of Oberon, so the points B and C hurt the more... Greetings Patrick