diff --git a/android/src/com/henrikrydgard/libnative/NativeActivity.java b/android/src/com/henrikrydgard/libnative/NativeActivity.java index 37561fbfa9..2f2edb526d 100644 --- a/android/src/com/henrikrydgard/libnative/NativeActivity.java +++ b/android/src/com/henrikrydgard/libnative/NativeActivity.java @@ -361,13 +361,11 @@ public class NativeActivity extends Activity { .setView(fl) .setTitle(title) .setPositiveButton(defaultAction, new DialogInterface.OnClickListener(){ - @Override public void onClick(DialogInterface d, int which) { d.dismiss(); } }) .setNegativeButton("Cancel", new DialogInterface.OnClickListener(){ - @Override public void onClick(DialogInterface d, int which) { d.cancel(); NativeActivity.inputBoxCancelled = false; diff --git a/thread/prioritizedworkqueue.cpp b/thread/prioritizedworkqueue.cpp index b51ab45a6f..a8ec8cc05c 100644 --- a/thread/prioritizedworkqueue.cpp +++ b/thread/prioritizedworkqueue.cpp @@ -31,6 +31,18 @@ void PrioritizedWorkQueue::Stop() { mutex_.unlock(); } +void PrioritizedWorkQueue::Flush() { + if (queue_.empty()) + return; + mutex_.lock(); + for (auto iter = queue_.begin(); iter != queue_.end(); ++iter) { + delete *iter; + } + queue_.clear(); + mutex_.unlock(); +} + + // The worker should simply call this in a loop. Will block when appropriate. PrioritizedWorkQueueItem *PrioritizedWorkQueue::Pop() { mutex_.lock(); @@ -67,6 +79,7 @@ static void threadfunc(PrioritizedWorkQueue *wq) { break; } else { item->run(); + delete item; } } } diff --git a/thread/prioritizedworkqueue.h b/thread/prioritizedworkqueue.h index e3e815d7a3..c2198a3d5b 100644 --- a/thread/prioritizedworkqueue.h +++ b/thread/prioritizedworkqueue.h @@ -31,6 +31,7 @@ public: // The worker should simply call this in a loop. Will block when appropriate. PrioritizedWorkQueueItem *Pop(); + void Flush(); bool Done() { return done_; } void Stop(); diff --git a/ui/ui.h b/ui/ui.h index 3bd7444661..22a566a6e9 100644 --- a/ui/ui.h +++ b/ui/ui.h @@ -112,7 +112,7 @@ public: *x = x_; *y = y_; y_ += *h + ySpacing_; - if (y_ >= yMax_) { + if (y_ + *h >= yMax_) { x_ += *w + xSpacing_; y_ = yInit_; }