summaryrefslogtreecommitdiff
path: root/src/preview/PreviewView.cpp
diff options
context:
space:
mode:
authorjacob1 <jfu614@gmail.com>2013-02-25 00:11:37 (GMT)
committer jacob1 <jfu614@gmail.com>2013-02-25 00:11:37 (GMT)
commitfbf52794e59ede9be4362a8816e0682e41dcf414 (patch)
tree3fce05c90530469832f16648a7adf10adb95b6e9 /src/preview/PreviewView.cpp
parentb92bd245c8b1311b6cd63171611e47a6468e410f (diff)
downloadpowder-fbf52794e59ede9be4362a8816e0682e41dcf414.zip
powder-fbf52794e59ede9be4362a8816e0682e41dcf414.tar.gz
fix even more memory leaks
Diffstat (limited to 'src/preview/PreviewView.cpp')
-rw-r--r--src/preview/PreviewView.cpp19
1 files changed, 15 insertions, 4 deletions
diff --git a/src/preview/PreviewView.cpp b/src/preview/PreviewView.cpp
index 4b12ea9..61a0c8f 100644
--- a/src/preview/PreviewView.cpp
+++ b/src/preview/PreviewView.cpp
@@ -411,7 +411,7 @@ void PreviewView::NotifySaveChanged(PreviewModel * sender)
float factorY = ((float)YRES/2)/((float)savePreview->Size.Y);
float scaleFactor = factorY < factorX ? factorY : factorX;
savePreview->Data = Graphics::resample_img(oldData, savePreview->Size.X, savePreview->Size.Y, savePreview->Size.X*scaleFactor, savePreview->Size.Y*scaleFactor);
- delete oldData;
+ delete[] oldData;
savePreview->Size.X *= scaleFactor;
savePreview->Size.Y *= scaleFactor;
}
@@ -453,14 +453,14 @@ void PreviewView::NotifyCommentBoxEnabledChanged(PreviewModel * sender)
if(addCommentBox)
{
RemoveComponent(addCommentBox);
- addCommentBox = NULL;
delete addCommentBox;
+ addCommentBox = NULL;
}
if(submitCommentButton)
{
RemoveComponent(submitCommentButton);
- submitCommentButton = NULL;
delete submitCommentButton;
+ submitCommentButton = NULL;
}
if(sender->GetCommentBoxEnabled())
{
@@ -561,6 +561,17 @@ void PreviewView::NotifyCommentsChanged(PreviewModel * sender)
}
}*/
-PreviewView::~PreviewView() {
+PreviewView::~PreviewView()
+{
+ if(addCommentBox)
+ {
+ RemoveComponent(addCommentBox);
+ delete addCommentBox;
+ }
+ if(submitCommentButton)
+ {
+ RemoveComponent(submitCommentButton);
+ delete submitCommentButton;
+ }
}