diff --git a/UI/window-basic-stats.cpp b/UI/window-basic-stats.cpp index e4db84a00..0675dc10d 100644 --- a/UI/window-basic-stats.cpp +++ b/UI/window-basic-stats.cpp @@ -30,6 +30,9 @@ void OBSBasicStats::OBSFrontendEvent(enum obs_frontend_event event, void *ptr) stats->ResetRecTimeLeft(); break; case OBS_FRONTEND_EVENT_EXIT: + // This is only reached when the non-closable (dock) stats + // window is being cleaned up. Thee closable stats window is + // already gone by this point as it's deleted on close. obs_frontend_remove_event_callback(OBSFrontendEvent, stats); break; default: @@ -231,6 +234,10 @@ void OBSBasicStats::closeEvent(QCloseEvent *event) config_save_safe(main->Config(), "tmp", nullptr); } + // This code is only reached when the non-dockable stats window is + // manually closed or OBS is exiting. + obs_frontend_remove_event_callback(OBSFrontendEvent, this); + QWidget::closeEvent(event); }