Merge branch 'fix-rectangles' into old-master
* fix-rectangles: Fix rectangles bug.
This commit is contained in:
@ -231,8 +231,14 @@ void Region::addRectangle (Rectangle *rPointer)
|
|||||||
auto r= std::make_unique< Rectangle >( rPointer->x, rPointer->y,
|
auto r= std::make_unique< Rectangle >( rPointer->x, rPointer->y,
|
||||||
rPointer->width, rPointer->height );
|
rPointer->width, rPointer->height );
|
||||||
|
|
||||||
for( auto &ownRect: rectangleList )
|
for( auto it= rectangleList.begin(); it != rectangleList.end(); )
|
||||||
{
|
{
|
||||||
|
// We have to increment immediately. The removal of the element, near the bottom
|
||||||
|
// of this loop will invalidate any iterators pointing into the rectangleList at
|
||||||
|
// that position. A range-based for loop will increment the iterator after the
|
||||||
|
// current pass, which would cause crashes.
|
||||||
|
auto &ownRect= *it++;
|
||||||
|
|
||||||
int combinedHeight =
|
int combinedHeight =
|
||||||
misc::max(r->y + r->height, ownRect->y + ownRect->height) -
|
misc::max(r->y + r->height, ownRect->y + ownRect->height) -
|
||||||
misc::min(r->y, ownRect->y);
|
misc::min(r->y, ownRect->y);
|
||||||
|
|||||||
Reference in New Issue
Block a user