Clear OSC queue on editor closed

This commit is contained in:
Jean Pierre Cimalando 2021-02-03 16:00:45 +01:00
parent 787f388a26
commit e431591d41

View file

@ -114,6 +114,7 @@ struct Editor::Impl : EditorController::Receiver, IControlListener {
// queued OSC API; sends OSC with intermediate delay between messages // queued OSC API; sends OSC with intermediate delay between messages
// to prevent message bursts overloading the buffer // to prevent message bursts overloading the buffer
void sendQueuedOSC(const char* path, const char* sig, const sfizz_arg_t* args); void sendQueuedOSC(const char* path, const char* sig, const sfizz_arg_t* args);
void clearQueuedOSC();
void tickOSCQueue(CVSTGUITimer* timer); void tickOSCQueue(CVSTGUITimer* timer);
std::queue<std::string> oscSendQueue_; std::queue<std::string> oscSendQueue_;
SharedPointer<CVSTGUITimer> oscSendQueueTimer_; SharedPointer<CVSTGUITimer> oscSendQueueTimer_;
@ -218,6 +219,8 @@ void Editor::close()
{ {
Impl& impl = *impl_; Impl& impl = *impl_;
impl.clearQueuedOSC();
if (impl.frame_) { if (impl.frame_) {
impl.frame_->removeView(impl.mainView_.get(), false); impl.frame_->removeView(impl.mainView_.get(), false);
impl.frame_ = nullptr; impl.frame_ = nullptr;
@ -461,6 +464,12 @@ void Editor::Impl::sendQueuedOSC(const char* path, const char* sig, const sfizz_
oscSendQueueTimer_->start(); oscSendQueueTimer_->start();
} }
void Editor::Impl::clearQueuedOSC()
{
while (!oscSendQueue_.empty())
oscSendQueue_.pop();
}
void Editor::Impl::tickOSCQueue(CVSTGUITimer* timer) void Editor::Impl::tickOSCQueue(CVSTGUITimer* timer)
{ {
if (oscSendQueue_.empty()) { if (oscSendQueue_.empty()) {