ecere/gui/FormDesigner: Fixed leaking ToolTips
authorJerome St-Louis <jerome@ecere.com>
Sat, 7 Jun 2014 07:41:14 +0000 (03:41 -0400)
committerJerome St-Louis <jerome@ecere.com>
Sat, 7 Jun 2014 07:41:14 +0000 (03:41 -0400)
- Calling CommonControls' OnDestroy for controls in the form designer

ecere/src/gui/FormDesigner.ec

index dd73a6f..67734c2 100644 (file)
@@ -802,6 +802,14 @@ static Window FindWindow(Window form, Window window, Window moved, int x, int y,
 static void OnDestroy(Window window)
 {
    FormDesigner designer = activeDesigner ? (FormDesigner)activeDesigner.classDesigner : null;
+   Class c = window._class;
+   if(c.base.type != systemClass && c.base.base.type != systemClass)
+   {
+      while(c.base.base.base.type != systemClass)
+         c = c.base;
+      if(!strcmp(c.fullName, "ecere::gui::CommonControl"))
+         CommonControl::OnDestroy((CommonControl)window);
+   }
 
    if(designer && designer.form)
       activeDesigner.DeleteObject(window.object);