Crash Report: [Stage Editor] Force-switching to Main Menu instead of saving causes NOR
Issue Checklist
- [x] I have read the Contributing Guide
- [x] I have checked the Issues/Discussions pages to see if my issue has already been reported
- [x] I have properly titled my issue
Platform
Itch.io (Downloadable Build) - Windows
Version
0.6.2
Description
When I force switch to Main Menu from the stage editor with unsaved progress and then try to exit it seems to throw a NOR?
https://github.com/user-attachments/assets/b7da5516-4716-4cc7-abd1-be6f0cbcff13
Steps to Reproduce
- Open Game
- Open Stage Editor
- Move some object/characters
- Press F4(Force-switch to MainMenu)
- Try to close game from the window X button
- Throws NOR
Crash logs
None
While this doesn't generate a crash log, this is what's printed to the console when it crashes:
source/funkin/ui/debug/stageeditor/StageEditorState.hx:769: closing da window ye source/funkin/ui/debug/stageeditor/StageEditorState.hx:773: dum dum why no save >:[ Called from hxcpp::__hxcpp_main Called from ApplicationMain::main ApplicationMain.hx line 26 Called from ApplicationMain::create ApplicationMain.hx line 137 Called from openfl.display.Application::exec openfl/display/Application.hx line 130 Called from lime.app.Application::exec lime/app/Application.hx line 151 Called from lime._internal.backend.native.NativeApplication::exec lime/_internal/backend/native/NativeApplication.hx line 147 Called from lime._internal.backend.native.NativeApplication::handleWindowEvent lime/_internal/backend/native/NativeApplication.hx line 529 Called from openfl.display.Window::close openfl/display/Window.hx line 82 Called from lime.ui.Window::close lime/ui/Window.hx line 392 Called from lime._internal.backend.native.NativeWindow::close lime/_internal/backend/native/NativeWindow.hx line 200 Called from lime.app._Event_Void_Void::dispatch lime/_internal/macros/EventMacro.hx line 91 Called from openfl.display.Application::createWindow openfl/display/Application.hx line 67 Called from lime.app.Application::__onWindowClose lime/app/Application.hx line 650 Called from lime.app.Application::__removeWindow lime/app/Application.hx line 587 Called from openfl.display.Application::__checkForAllWindowsClosed openfl/display/Application.hx line 155 Called from lime.app.Application::__checkForAllWindowsClosed lime/app/Application.hx line 598 Called from lime.system.System::exit lime/system/System.hx line 213 Called from lime.app._Event_Int_Void::dispatch lime/_internal/macros/EventMacro.hx line 91 Called from funkin.util.WindowUtil::initWindowEvents funkin/util/WindowUtil.hx line 115 Called from flixel.util._FlxSignal.FlxSignal1::dispatch1 flixel/util/FlxSignal.hx line 297 Called from funkin.ui.debug.stageeditor.StageEditorState::windowClose funkin/ui/debug/stageeditor/StageEditorState.hx line 774 Called from funkin.ui.debug.stageeditor.StageEditorState::set_saved funkin/ui/debug/stageeditor/StageEditorState.hx line 197 Called from funkin.ui.debug.stageeditor.handlers.StageDataHandler::packShitToZip funkin/ui/debug/stageeditor/handlers/StageDataHa ndler.hx line 35 Called from funkin.ui.debug.stageeditor.handlers.AssetDataHandler::toData funkin/ui/debug/stageeditor/handlers/AssetDataHandler.h x line 38 source/funkin/api/discord/DiscordClient.hx:59: [DISCORD] Performing client update...
Edit: Ah, the issue is that when you forcibly switch to the Main Menu the Stage Editor's onWindowClose event doesn't get removed, so when you try to close the game it will be called, which will try to back up data that's now invalid since you're not on the stage editor anymore. A fix to this would be to make the stage editor remove that window exit event and also back up the data when exiting the state.
Fixed in #3974 thanks for reporting