Got rid of a memleak.

This commit is contained in:
dfighter1985 2014-06-27 00:47:29 +02:00
parent 78c83d83b0
commit 6dd11d7fad
2 changed files with 21 additions and 6 deletions

View file

@ -198,6 +198,9 @@ namespace GUIEditor
browser = NULL;
propertyMgr = new QtVariantPropertyManager;
enumMgr = new QtEnumPropertyManager;
variantFactory = new QtVariantEditorFactory;
enumFactory = new QtEnumEditorFactory;
}
CPropBrowserCtrl::~CPropBrowserCtrl()
@ -207,6 +210,11 @@ namespace GUIEditor
delete propertyMgr;
propertyMgr = NULL;
delete variantFactory;
variantFactory = NULL;
delete enumFactory;
enumFactory = NULL;
browser = NULL;
}
@ -257,6 +265,14 @@ namespace GUIEditor
std::string n = e->getClassName();
setupProperties( n, e );
// Need to set these up every time, otherwise the editors won't work
// probably the clear() method clears them too...
browser->setFactoryForManager( propertyMgr, variantFactory );
browser->setFactoryForManager( enumMgr, enumFactory );
enablePropertyWatchers();
}
@ -381,12 +397,6 @@ namespace GUIEditor
nameToType[ prop.propName ] = prop.propType;
setupProperty( prop, element );
}
QtVariantEditorFactory *factory = new QtVariantEditorFactory;
browser->setFactoryForManager( propertyMgr, factory );
QtEnumEditorFactory *efactory = new QtEnumEditorFactory;
browser->setFactoryForManager( enumMgr, efactory );
}
void CPropBrowserCtrl::setupProperty( const SPropEntry &prop, const CInterfaceElement *element )

View file

@ -26,6 +26,8 @@
class QtTreePropertyBrowser;
class QtVariantPropertyManager;
class QtEnumPropertyManager;
class QtVariantEditorFactory;
class QtEnumEditorFactory;
class QtProperty;
class QVariant;
@ -69,6 +71,9 @@ namespace GUIEditor
QtVariantPropertyManager *propertyMgr;
QtEnumPropertyManager *enumMgr;
QtVariantEditorFactory *variantFactory;
QtEnumEditorFactory *enumFactory;
std::string currentElement;
std::map< std::string, SWidgetInfo > widgetInfo;
std::map< std::string, std::string > nameToType;