From f34ce17bf0b1e391cc65f4489b30d8b13c6ec0ba Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Tue, 24 Oct 2023 16:26:50 -0600 Subject: [PATCH] websocket: event loop names and thread/evloop pairs are set in BaseUI::main_thread() There is no thread when an AbstractUI is constructed. The event loop name and the association between the event loop object and the thread that "runs" it must be set from within the thread, which is not created until BaseUI::run() is called. There appears to have been some confusion in e3569b64 about how this all works; this commit should remove that --- libs/surfaces/websockets/feedback.cc | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/libs/surfaces/websockets/feedback.cc b/libs/surfaces/websockets/feedback.cc index d083a6ff2e..6fa8205bd5 100644 --- a/libs/surfaces/websockets/feedback.cc +++ b/libs/surfaces/websockets/feedback.cc @@ -102,21 +102,10 @@ struct PluginParamValueObserver { FeedbackHelperUI::FeedbackHelperUI() : AbstractUI ("WS_FeedbackHelperUI") { - // This renames and changes the event loop for the main thread, presumably - // 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