Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit d411f8da authored by Matt Mower's avatar Matt Mower Committed by Dees Troy
Browse files

GUI: Prevent duplicate page overlays

If a page is requested for overlay, ensure it doesn't already exist in
the stack of existing overlays. If it does, erase the existing page
and push_back the new one.

Change-Id: I9feeea06cf7aad2e08a8c3bc567aaa761db2c3bc
parent cf94db1d
Loading
Loading
Loading
Loading
+11 −0
Original line number Diff line number Diff line
@@ -936,6 +936,17 @@ int PageSet::SetOverlay(Page* page)
			LOGERR("Too many overlays requested, max is 10.\n");
			return -1;
		}

		std::vector<Page*>::iterator iter;
		for (iter = mOverlays.begin(); iter != mOverlays.end(); iter++) {
			if ((*iter)->GetName() == page->GetName()) {
				mOverlays.erase(iter);
				// SetOverlay() is (and should stay) the only function which
				// adds to mOverlays. Then, each page can appear at most once.
				break;
			}
		}

		page->SetPageFocus(1);
		page->NotifyVarChange("", "");