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
diff --git a/gui/pages.cpp b/gui/pages.cpp
index 7107c92..975d40f 100644
--- a/gui/pages.cpp
+++ b/gui/pages.cpp
@@ -936,6 +936,17 @@
 			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("", "");