Skip to content
Snippets Groups Projects
Commit 03c7ef34 authored by ariotte's avatar ariotte
Browse files

fixed memory leak in thresholding

parent ccc347e5
No related branches found
No related tags found
No related merge requests found
...@@ -71,8 +71,10 @@ void ThresholdDialog::updatePreview(){ ...@@ -71,8 +71,10 @@ void ThresholdDialog::updatePreview(){
else { else {
algo = new Binarization_t<GrayscaleImage::depth_t>(_spinbox1->value()); algo = new Binarization_t<GrayscaleImage::depth_t>(_spinbox1->value());
} }
_previewImage = algo->operator()(_image);
_preview->setImage(algo->operator()(_image)); _preview->setImage(_previewImage);
delete algo;
delete _previewImage;
_preview->repaint(); _preview->repaint();
} }
......
...@@ -64,6 +64,7 @@ class ThresholdDialog : public QDialog { ...@@ -64,6 +64,7 @@ class ThresholdDialog : public QDialog {
QRadioButton* _blackButton; QRadioButton* _blackButton;
QCheckBox *_doubleBox, *_previewBox; QCheckBox *_doubleBox, *_previewBox;
ImageWidget* _preview; ImageWidget* _preview;
imagein::GrayscaleImage* _previewImage;
}; };
#endif //!THRESHOLDDIALOG_H #endif //!THRESHOLDDIALOG_H
...@@ -40,5 +40,6 @@ void ThresholdOp::operator()(const imagein::Image* image, const std::map<const i ...@@ -40,5 +40,6 @@ void ThresholdOp::operator()(const imagein::Image* image, const std::map<const i
} }
GrayscaleImage* resImg = algo->operator()(img); GrayscaleImage* resImg = algo->operator()(img);
delete algo;
this->outImage(resImg); this->outImage(resImg);
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment