Bugfixing #4580 "RT 5.4 on Windows 8.1 x64 crashes while in editor"

Wrong placement of Mutex protecting the CropHandler's pixbufs in
cropwindow.cc + mixup between cropPixbuf & cropPixbuftrue
This commit is contained in:
Hombre
2018-06-01 21:45:47 +02:00
parent 93b3f07bc6
commit ed081923d7
3 changed files with 21 additions and 20 deletions

View File

@@ -64,7 +64,8 @@ public:
bool gamutICC; // no longer used
bool gamutLch;
bool HistogramWorking;
bool HistogramWorking; // true: histogram is display the value of the image computed in the Working profile
// false: histogram is display the value of the image computed in the Output profile
int amchroma;
int protectred;
double protectredh;

View File

@@ -97,8 +97,8 @@ public:
rtengine::procparams::CropParams cropParams;
rtengine::procparams::ColorManagementParams colorParams;
Glib::RefPtr<Gdk::Pixbuf> cropPixbuf;
Glib::RefPtr<Gdk::Pixbuf> cropPixbuftrue;
Glib::RefPtr<Gdk::Pixbuf> cropPixbuf; // image displayed on monitor, using the monitor profile (i.e. lab to monitor profile)
Glib::RefPtr<Gdk::Pixbuf> cropPixbuftrue; // internal image in output color space for analysis (i.e. lab to either Working profile or Output profile, depending on options.rtSettings.HistogramWorking)
MyMutex cimg;

View File

@@ -1007,6 +1007,8 @@ void CropWindow::pointerMoved (int bstate, int x, int y)
int mx, my;
screenCoordToImage (x, y, mx, my);
MyMutex::MyLock lock(cropHandler.cimg);
if (!onArea (CropImage, x, y) || !cropHandler.cropPixbuf) {
cropHandler.getFullImageSize(mx, my);
// pmlistener->pointerMoved (false, cropHandler.colorParams.working, mx, my, -1, -1, -1);
@@ -1023,7 +1025,7 @@ void CropWindow::pointerMoved (int bstate, int x, int y)
}
} else {
/*MyMutex::MyLock lock(cropHandler.cimg);
/*
int vx = x - xpos - imgX;
int vy = y - ypos - imgY;
@@ -1033,7 +1035,6 @@ void CropWindow::pointerMoved (int bstate, int x, int y)
*/
cropHandler.cimg.lock ();
int vx = x - xpos - imgX;
int vy = y - ypos - imgY;
@@ -1045,9 +1046,9 @@ void CropWindow::pointerMoved (int bstate, int x, int y)
// guint8* pix = cropHandler.cropPixbuf->get_pixels() + vy*cropHandler.cropPixbuf->get_rowstride() + vx*3;
// if (vx < cropHandler.cropPixbuf->get_width() && vy < cropHandler.cropPixbuf->get_height())
// pmlistener->pointerMoved (true, mx, my, pix[0], pix[1], pix[2]);
int imwidth = cropHandler.cropPixbuf->get_width();
int imheight = cropHandler.cropPixbuf->get_height();
guint8* pix = cropHandler.cropPixbuftrue->get_pixels() + vy * cropHandler.cropPixbuf->get_rowstride() + vx * 3;
int imwidth = cropHandler.cropPixbuftrue->get_width();
int imheight = cropHandler.cropPixbuftrue->get_height();
guint8* pix = cropHandler.cropPixbuftrue->get_pixels() + vy * cropHandler.cropPixbuftrue->get_rowstride() + vx * 3;
int rval = pix[0];
int gval = pix[1];
@@ -1062,17 +1063,16 @@ void CropWindow::pointerMoved (int bstate, int x, int y)
isrc->getRawValues(mx, my, params.coarse.rotate, rval, gval, bval);
}
}
// pmlistener->pointerMoved (true, cropHandler.colorParams.working, mx, my, pix[0], pix[1], pix[2]);
// Updates the Navigator
// TODO: possible double color conversion if rval, gval, bval come from cropHandler.cropPixbuftrue ? see issue #4583
pmlistener->pointerMoved (true, cropHandler.colorParams.output, cropHandler.colorParams.working, mx, my, rval, gval, bval);
if (pmhlistener)
// pmhlistener->pointerMoved (true, cropHandler.colorParams.working, mx, my, pix[0], pix[1], pix[2]);
{
pmhlistener->pointerMoved (true, cropHandler.colorParams.output, cropHandler.colorParams.working, mx, my, pix[0], pix[1], pix[2]);
if (pmhlistener) {
// Updates the HistogramRGBArea
pmhlistener->pointerMoved (true, cropHandler.colorParams.output, cropHandler.colorParams.working, mx, my, rval, gval, bval);
}
}
cropHandler.cimg.unlock ();
}
}
}