WebSockets: fix crash when switching snapshots #9506
This commit is contained in:
parent
e0f543d8fb
commit
1dbc3305fa
|
@ -103,16 +103,22 @@ FeedbackHelperUI::FeedbackHelperUI()
|
|||
: AbstractUI<BaseUI::BaseRequestObject> ("WS_FeedbackHelperUI")
|
||||
{
|
||||
// This renames and changes the event loop for the main thread, presumably
|
||||
// this is not the actually desired behavior. If this is intentional, at
|
||||
// least the event loop should be set back when this FeedbackHelperUI is
|
||||
// destroyed, as otherwise future access to the event loop is likely going
|
||||
// to crash.
|
||||
// this is not the actually desired behavior.
|
||||
char name[64];
|
||||
snprintf (name, 64, "WS-%p", (void*)DEBUG_THREAD_SELF);
|
||||
pthread_set_name (name);
|
||||
/* The event loop needs to be restored when FeedbackHelperUI is destroyed,
|
||||
* otherwise future access will result in a crash (heap-use-after-free).
|
||||
*/
|
||||
_main_event_loop = get_event_loop_for_thread ();
|
||||
set_event_loop_for_thread (this);
|
||||
}
|
||||
|
||||
FeedbackHelperUI::~FeedbackHelperUI ()
|
||||
{
|
||||
set_event_loop_for_thread (_main_event_loop);
|
||||
}
|
||||
|
||||
void
|
||||
FeedbackHelperUI::do_request (BaseUI::BaseRequestObject* req) {
|
||||
if (req->type == CallSlot) {
|
||||
|
|
|
@ -36,11 +36,14 @@ class FeedbackHelperUI : public AbstractUI<BaseUI::BaseRequestObject>
|
|||
{
|
||||
public:
|
||||
FeedbackHelperUI ();
|
||||
~FeedbackHelperUI () {};
|
||||
~FeedbackHelperUI ();
|
||||
|
||||
protected:
|
||||
virtual void do_request (BaseUI::BaseRequestObject*);
|
||||
|
||||
private:
|
||||
PBD::EventLoop* _main_event_loop;
|
||||
|
||||
};
|
||||
|
||||
class ArdourFeedback : public SurfaceComponent
|
||||
|
|
Loading…
Reference in New Issue