Prechádzať zdrojové kódy

More memory leak fixes in IDE

Ivan Safrin 12 rokov pred
rodič
commit
cdf57e0f6f

+ 1 - 3
IDE/Contents/Include/PolycodeMaterialEditor.h

@@ -277,7 +277,7 @@ class MaterialEditorPane : public UIElement {
 class MaterialMainWindow : public UIElement {
 	public:
 	MaterialMainWindow(ResourcePool *resourcePool);
-	~MaterialMainWindow(){}
+	~MaterialMainWindow();
 	
 	void Resize(Number width, Number height);
 	
@@ -307,8 +307,6 @@ class PolycodeMaterialEditor : public PolycodeEditor {
 	protected:
     
         ResourcePool *resourcePool;
-    
-		UIImage *editorImage;
 		
 		MaterialBrowser *materialBrowser;
 		UIHSizer *mainSizer;

+ 3 - 2
IDE/Contents/Source/PolycodeFrame.cpp

@@ -533,9 +533,10 @@ EditorHolder::EditorHolder(PolycodeProject *project, PolycodeEditorManager *edit
 	initialUpdate = true;
 	updateFileSelector();
 	
-	editorToMerge = NULL;	
-	
+	editorToMerge = NULL;
 	isActive = false;
+    
+    setOwnsChildrenRecursive(true);
 }
 
 ObjectEntry *EditorHolder::getEditorHolderConfig() {

+ 19 - 5
IDE/Contents/Source/PolycodeMaterialEditor.cpp

@@ -654,7 +654,9 @@ void PostPreviewBox::Resize(Number width, Number height) {
 }
 
 PostPreviewBox::~PostPreviewBox() {
-
+    previewScene->rootEntity.setOwnsChildrenRecursive(true);
+    delete previewScene;
+    delete renderTexture;
 }
 
 void PostPreviewBox::setMaterial(Material *material) {
@@ -765,7 +767,9 @@ void MaterialPreviewBox::clearMaterial() {
 }
 
 MaterialPreviewBox::~MaterialPreviewBox() {
-
+    delete renderTexture;
+    previewScene->rootEntity.setOwnsChildrenRecursive(true);
+    delete previewScene;
 }
 
 void MaterialPreviewBox::setMaterial(Material *material) {
@@ -989,12 +993,16 @@ MaterialMainWindow::MaterialMainWindow(ResourcePool *resourcePool) : UIElement()
 	shaderPane = new ShaderEditorPane(resourcePool);
 	cubemapPane = new CubemapEditorPane(resourcePool);
 	postPane = new PostEditorPane(resourcePool);
-		
+    
+    ownsChildren = true;
+    
 	addChild(materialPane);
 	addChild(shaderPane);	
 	addChild(cubemapPane);
-	addChild(postPane);	
-	enableScissor = true;
+	addChild(postPane);
+}
+
+MaterialMainWindow::~MaterialMainWindow() {
 }
 	
 void MaterialMainWindow::Resize(Number width, Number height) {	
@@ -1112,6 +1120,12 @@ PolycodeMaterialEditor::PolycodeMaterialEditor() : PolycodeEditor(true){
 
 PolycodeMaterialEditor::~PolycodeMaterialEditor() {
 	delete resourcePool;
+    
+    
+    mainWindow->setOwnsChildrenRecursive(true);
+    delete mainWindow;
+    delete mainSizer;
+    delete materialBrowser;
 }
 
 bool PolycodeMaterialEditor::openFile(OSFileEntry filePath) {

+ 3 - 5
IDE/Contents/Source/PolycodeTextEditor.cpp

@@ -454,7 +454,9 @@ PolycodeTextEditor::PolycodeTextEditor() : PolycodeEditor(true){
 }
 
 PolycodeTextEditor::~PolycodeTextEditor() {
+    textInput->setOwnsChildrenRecursive(true);
 	delete textInput;
+    findBar->setOwnsChildrenRecursive(true);
 	delete findBar;
 	if(syntaxHighligher)
 		delete syntaxHighligher;
@@ -711,11 +713,7 @@ void FindBar::onKeyDown(PolyKEY key, wchar_t charCode) {
 }
 
 FindBar::~FindBar(){
-	delete findInput;
-	delete replaceInput;
-	delete closeButton;
-	delete replaceAllButton;
-	delete barBg;
+
 }
 
 void FindBar::setBarWidth(int width) {