X Tutup
Skip to content

Fix assert on startup when calling back on an empty string#5717

Merged
sturnclaw merged 2 commits intopioneerspacesim:masterfrom
JonBooth78:fix-assert-on-game-load
Jan 19, 2024
Merged

Fix assert on startup when calling back on an empty string#5717
sturnclaw merged 2 commits intopioneerspacesim:masterfrom
JonBooth78:fix-assert-on-game-load

Conversation

@JonBooth78
Copy link
Contributor

Fixes #5716

@JonBooth78 JonBooth78 force-pushed the fix-assert-on-game-load branch from f5f76d9 to 7b2770f Compare January 18, 2024 07:05
@Max5377
Copy link
Contributor

Max5377 commented Jan 18, 2024

The question is, why module_name is empty in the first place when it should normally return lua module name?

@sturnclaw
Copy link
Member

The module name is empty because LuaConsole.cpp is directly calling Event.Register(...) and the calling module context requested from Event.Register is a C function which has no valid filepath and therefore cannot be translated into a module name.

This technically exposes a flaw in the new Event system where C++ can only register one Lua callback handler for each event type without overwriting the previously-set handler. That's not a problem in practice (as generally speaking a C++ function shouldn't be listening for a Lua event but rather use a sigc::signal instead), but something I'll have to keep in mind for the future.

@sturnclaw sturnclaw merged commit a2170e9 into pioneerspacesim:master Jan 19, 2024
@JonBooth78 JonBooth78 deleted the fix-assert-on-game-load branch February 3, 2024 20:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

"Assertion failed!" when the game is loading

3 participants

X Tutup