Index: chrome/browser/sync/glue/synced_session_tracker.cc |
diff --git a/chrome/browser/sync/glue/synced_session_tracker.cc b/chrome/browser/sync/glue/synced_session_tracker.cc |
index d5cad409f4c2cd08ce626f8430744b21f333bdff..57485bea1672c6f32b7417c26f218ca38bfc725b 100644 |
--- a/chrome/browser/sync/glue/synced_session_tracker.cc |
+++ b/chrome/browser/sync/glue/synced_session_tracker.cc |
@@ -286,8 +286,20 @@ void SyncedSessionTracker::PutTabInWindow(const std::string& session_tag, |
// collected eventually. |
SessionTab* tab_ptr = GetTabImpl( |
session_tag, tab_id, TabNodePool::kInvalidTabNodeID); |
+ |
+ // It's up to the caller to ensure this never happens. Tabs should not |
+ // belong to more than one window or appear twice within the same window. |
+ // |
+ // If this condition were violated, we would double-free during shutdown. |
+ // That could cause all sorts of hard to diagnose crashes, possibly in code |
+ // far away from here. We crash early to avoid this. |
+ // |
+ // See http://crbug.com/360822. |
+ CHECK(!synced_tab_map_[session_tag][tab_id].owned); |
+ |
unmapped_tabs_.erase(tab_ptr); |
synced_tab_map_[session_tag][tab_id].owned = true; |
+ |
tab_ptr->window_id.set_id(window_id); |
DVLOG(1) << " - tab " << tab_id << " added to window "<< window_id; |
DCHECK(GetSession(session_tag)->windows.find(window_id) != |