Fix crash in DesktopRegion::Intersect().

BUG=crbug.com/266933
R=alexeypa@chromium.org

Review URL: https://webrtc-codereview.appspot.com/1938004

git-svn-id: http://webrtc.googlecode.com/svn/trunk@4468 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
sergeyu@chromium.org 2013-08-01 19:51:04 +00:00
parent 86d7a198ec
commit 17758e96c5
2 changed files with 5 additions and 2 deletions

View File

@ -208,10 +208,10 @@ void DesktopRegion::Intersect(const DesktopRegion& region1,
if (new_row->second->spans.empty()) {
delete new_row->second;
rows_.erase(new_row);
} else {
MergeWithPrecedingRow(new_row);
}
MergeWithPrecedingRow(new_row);
// If |it1| was completely consumed, move to the next one.
if (it1->second->bottom == bottom)
++it1;

View File

@ -426,6 +426,9 @@ TEST(DesktopRegionTest, Intersect) {
DesktopRect::MakeLTRB(50, 30, 90, 50) },
2, { DesktopRect::MakeLTRB(50, 10, 100, 30),
DesktopRect::MakeLTRB(50, 30, 90, 50) } },
{ 1, { DesktopRect::MakeLTRB(0, 0, 100, 100) },
1, { DesktopRect::MakeLTRB(100, 50, 200, 200) },
0, {} },
};
for (size_t i = 0; i < (sizeof(cases) / sizeof(Case)); ++i) {