Fix #109952: Unknown engine warning only shown when loading from a popup

Displaying the warning on file load depended on `wm->winactive`
being set, and didn't work when loading a file from the file-open
window or when loading files using a command-line argument.

Resolve using the first window as a fallback.
This happens to resolve #109770, although not freeing timers on exit
is likely to be an issue under other circumstances.
This commit is contained in:
Campbell Barton 2023-07-11 12:21:04 +10:00
parent 6239246c9c
commit 8a73c36643
1 changed files with 2 additions and 1 deletions

View File

@ -885,13 +885,14 @@ static void wm_event_handler_ui_cancel(bContext *C)
void WM_report_banner_show()
{
wmWindowManager *wm = static_cast<wmWindowManager *>(G_MAIN->wm.first);
wmWindow *win = wm->winactive ? wm->winactive : static_cast<wmWindow *>(wm->windows.first);
ReportList *wm_reports = &wm->reports;
/* After adding reports to the global list, reset the report timer. */
WM_event_remove_timer(wm, nullptr, wm_reports->reporttimer);
/* Records time since last report was added. */
wm_reports->reporttimer = WM_event_add_timer(wm, wm->winactive, TIMERREPORT, 0.05);
wm_reports->reporttimer = WM_event_add_timer(wm, win, TIMERREPORT, 0.05);
ReportTimerInfo *rti = MEM_cnew<ReportTimerInfo>(__func__);
wm_reports->reporttimer->customdata = rti;