Index: chrome/browser/chromeos/drive/search_metadata.cc |
diff --git a/chrome/browser/chromeos/drive/search_metadata.cc b/chrome/browser/chromeos/drive/search_metadata.cc |
index 2e4a1d690a691c8eae6c1951adbddcd3611a1302..8886356c04eecfa8020742c3dfd06ebf8d39dc00 100644 |
--- a/chrome/browser/chromeos/drive/search_metadata.cc |
+++ b/chrome/browser/chromeos/drive/search_metadata.cc |
@@ -78,8 +78,12 @@ class ScopedPriorityQueue { |
void push(T* x) { queue_.push(x); } |
void pop() { |
- delete queue_.top(); |
+ // Keep top alive for the pop() call so that debug checks can access |
+ // underlying data (e.g. validating heap property of the priority queue |
+ // will call the comparator). |
+ T* saved_top = queue_.top(); |
queue_.pop(); |
+ delete saved_top; |
} |
private: |