Solving issue 2324: "Crash when creating detail window" / Credits: Ingo, Hombre

This commit is contained in:
natureh.510
2014-04-03 23:15:48 +02:00
parent d79d3c3f7a
commit 2b873eb0d4
5 changed files with 12 additions and 6 deletions

View File

@@ -47,11 +47,12 @@ Crop::Crop (ImProcCoordinator* parent, EditDataProvider *editDataProvider)
Crop::~Crop () {
MyMutex::MyLock cropLock(cropMutex);
MyMutex::MyLock processingLock(parent->mProcessing);
std::vector<Crop*>::iterator i = std::find (parent->crops.begin(), parent->crops.end(), this);
if (i!=parent->crops.end ())
parent->crops.erase (i);
MyMutex::MyLock processingLock(parent->mProcessing);
freeAll ();
}

View File

@@ -45,7 +45,8 @@ CropHandler::~CropHandler () {
setEnabled (false);
if (crop) {
crop->destroy ();
//crop->destroy ();
delete crop; // will do the same than destroy, plus delete the object
crop = NULL;
}
cimg.lock ();

View File

@@ -459,8 +459,12 @@ void CropWindow::buttonRelease (int button, int num, int bstate, int x, int y) {
if (decorated)
buttonSet.releaseNotify (x, y);
if (deleted)
if (deleted) {
iarea->flawnOverWindow = NULL;
delete this;
return;
}
state = SNormal;
iarea->grabFocus (NULL);

View File

@@ -382,8 +382,9 @@ void ImageArea::addCropWindow () {
cw->setPosition (col*get_width()/K + hBorder/2 + layer*30, row*get_height()/K + vBorder/2 + layer*30);
}
else {
cw->setPosition (lastClosedX, lastClosedY);
cw->setSize(lastClosedW, lastClosedH);
cw->setPosition (lastClosedX, lastClosedY);
lastClosedX = -1;
}
int x0,y0,w,h,wc,hc;
mainCropWindow->getCropRectangle(x0,y0,w,h );
@@ -414,7 +415,6 @@ void ImageArea::cropWindowClosed (CropWindow* cw) {
std::list<CropWindow*>::iterator i = std::find (cropWins.begin(), cropWins.end(), cw);
if (i!=cropWins.end())
cropWins.erase (i);
delete cw;
if (!cropWins.empty())
mainCropWindow->setObservedCropWin (cropWins.front());
else

View File

@@ -55,7 +55,6 @@ class ImageArea : public Gtk::DrawingArea, public CropWindowListener, public Edi
bool dirty;
CropWindow* focusGrabber;
CropWindow* flawnOverWindow;
CropGUIListener* cropgl;
PointerMotionListener* pmlistener;
PointerMotionListener* pmhlistener;
@@ -65,6 +64,7 @@ class ImageArea : public Gtk::DrawingArea, public CropWindowListener, public Edi
public:
CropWindow* mainCropWindow;
CropWindow* flawnOverWindow;
ZoomPanel* zoomPanel;
IndicateClippedPanel* indClippedPanel;
PreviewModePanel* previewModePanel;