From b1b57571e764e96255ff4bc7f1c8d4f557156a8e Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Thu, 9 Jun 2022 02:03:34 +0200 Subject: [PATCH] Prevent RealTimeOperation EventQueue clogging It can happen that the EventQueue fills up with SessionEvent::RealTimeOperation. Those are to scheduled to be free()ed later the GUI thread via event_loop->call_slot(). However it can happen that the GUI EventPool is full, so the request to call Session::rt_cleanup, is never executed. In this case the SessionEvent pool can fill up with RealTime Operations which remain there permanently. --- libs/ardour/session_rtevents.cc | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/libs/ardour/session_rtevents.cc b/libs/ardour/session_rtevents.cc index 65dad92182..8ff11a7523 100644 --- a/libs/ardour/session_rtevents.cc +++ b/libs/ardour/session_rtevents.cc @@ -24,6 +24,7 @@ #include "pbd/compose.h" #include "ardour/audioengine.h" +#include "ardour/butler.h" #include "ardour/monitor_control.h" #include "ardour/route.h" #include "ardour/session.h" @@ -160,7 +161,12 @@ Session::process_rtop (SessionEvent* ev) ev->rt_slot (); if (ev->event_loop) { - ev->event_loop->call_slot (MISSING_INVALIDATOR, boost::bind (ev->rt_return, ev)); + if (!ev->event_loop->call_slot (MISSING_INVALIDATOR, boost::bind (ev->rt_return, ev))) { + /* The event must be deleted, otherwise the SessionEvent Pool may fill up */ + if (!butler ()->delegate (boost::bind (ev->rt_return, ev))) { + ev->rt_return (ev); + } + } } else { warning << string_compose ("programming error: %1", X_("Session RT event queued from thread without a UI - cleanup in RT thread!")) << endmsg; ev->rt_return (ev);