fixed use of pointer after memory ownership transferred to QCache

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@8429 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
csoler 2015-06-14 09:21:24 +00:00
parent c077091693
commit 8cb423f20d

View File

@ -740,10 +740,12 @@ QImage* PictureFlowSoftwareRenderer::surface(int slideIndex)
return surfaceCache[key];
QImage* sr = prepareSurface(img, state->slideWidth, state->slideHeight, bgcolor, state->reflectionEffect);
surfaceCache.insert(key, sr);
QImage *sr_copy = new QImage(*sr) ;
surfaceCache.insert(key, sr); // this takes ownership on sr. So we can't use it afterwards
imageHash.insert(slideIndex, img);
return sr;
return sr_copy;
}
// Renders a slide to offscreen buffer. Returns a rect of the rendered area.
@ -786,7 +788,10 @@ QRect PictureFlowSoftwareRenderer::renderSlide(const SlideInfo &slide, int col1,
int xi = qMax((PFreal)0, ((w*PFREAL_ONE/2) + fdiv(xs*h, dist+ys)) >> PFREAL_SHIFT);
if(xi >= w)
{
delete src ;
return rect;
}
bool flag = false;
rect.setLeft(xi);
@ -856,6 +861,8 @@ QRect PictureFlowSoftwareRenderer::renderSlide(const SlideInfo &slide, int col1,
rect.setTop(0);
rect.setBottom(h-1);
delete src ;
return rect;
}