Safety fix: clear "_this->wakeup_window" when destroying the window (cherry picked from commit c838ccf0e3a330ebbcf433698b8f5370c6fa80d6)