You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix: join the connect-notify thread instead of detaching it
After a successful connect the bus thread spawned a detached thread to run
notifyDevicesConnected() (onBusConnected() blocks on future.get(), so it cannot
run on the bus thread). That thread locks mtx_ and schedules retries, but the
destructor never waited for it: on a shutdown shortly after a connect it could
lock mtx_ after ~FroniusBus had destroyed it, aborting with
std::system_error "Invalid argument" from pthread_mutex_lock on a freed mutex.
Track it as notifyConnectThread_ (a reconnect joins the previous one first)
and join it in the destructor, after the bus thread and before retries_ is
moved out. running_ is already false by then, so any scheduleDeviceRetry() it
runs returns without queuing work and the join is immediate; retries it did
schedule are still captured by the existing retries_ join.