Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2490)

Unified Diff: dart/runtime/bin/eventhandler.h

Issue 914203002: Add unittest for CircularLinkedList + bugfix (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: dart/runtime/bin/eventhandler.h
diff --git a/dart/runtime/bin/eventhandler.h b/dart/runtime/bin/eventhandler.h
index 9ed872ffe11781493b77df569de7dda85717beaa..c110d343dcab9d2779d03568e5ed2b33ba3b9b22 100644
--- a/dart/runtime/bin/eventhandler.h
+++ b/dart/runtime/bin/eventhandler.h
@@ -150,6 +150,8 @@ class CircularLinkedList {
}
void RemoveHead() {
+ ASSERT(head_ != NULL);
+
Entry* e = head_;
if (e->next_ == e) {
head_ = NULL;
@@ -178,6 +180,11 @@ class CircularLinkedList {
Entry *prev = current->prev_;
prev->next_ = next;
next->prev_ = prev;
+
+ if (current == head_) {
+ head_ = head_->next_;
+ }
+
delete current;
return;
}
@@ -207,7 +214,7 @@ class CircularLinkedList {
private:
struct Entry {
- explicit Entry(const T& t) : t(t) {}
+ explicit Entry(const T& t) : t(t), next_(NULL), prev_(NULL) {}
const T t;
Entry* next_;
Entry* prev_;

Powered by Google App Engine
This is Rietveld 408576698