How to free a subclass of a gadget ?

Mac OSX specific forum
Wolfram
Enthusiast
Enthusiast
Posts: 568
Joined: Thu May 30, 2013 4:39 pm

How to free a subclass of a gadget ?

Post by Wolfram »

I use the following code to build a subclass for two gadgets.
If I close the window and reopen it the program crashes.
I think I have to free the class on closing the window, but I don't know how?

Code: Select all

Procedure SubclassGadget(gadget.i, newClassName.s)
  Protected gadgetClass.i = CocoaMessage(0, GadgetID(gadget), "class")
  Protected newGadgetClass.i

  newGadgetClass = objc_allocateClassPair_(GadgetClass, newClassName, 0)
   objc_registerClassPair_(newGadgetClass)
  object_setClass_(GadgetID(gadget), newGadgetClass)

  ProcedureReturn newGadgetClass
EndProcedure
macOS Catalina 10.15.7
User avatar
mk-soft
Always Here
Always Here
Posts: 5398
Joined: Fri May 12, 2006 6:51 pm
Location: Germany

Re: How to free a subclass of a gadget ?

Post by mk-soft »

Don't forget set to old class!

Code: Select all

  ImportC ""
    objc_disposeClassPair(*Class)
  EndImport
Link: Class-Helper viewtopic.php?f=19&t=72642
My Projects ThreadToGUI / OOP-BaseClass / EventDesigner V3
PB v3.30 / v5.75 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace / OneDrive
Post Reply