-
Notifications
You must be signed in to change notification settings - Fork 56
Fix headless export crash by adding TOOLS_ENABLED guards and fixing signal registration #238
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
@copilot Step 3: Check the error output when trying to generate a build with |
I've completed all three debugging steps you requested: Step 1: ✅ Built inventory system libs with debug_symbols=true for Linux Root cause identified: Duplicate signal registration in editor classes causing memory corruption. The crash occurs when The debugging infrastructure is now in place with a minimal test project that reproduces the issue consistently. See Commit: dc82cf2 Warning Firewall rules blocked me from connecting to one or more addressesI tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
|
@copilot Now try to fix the previously reported error. |
I've fixed the duplicate signal registration issue that was causing the headless export crash. The root cause was that both The fix: Added proper parent This prevents the memory corruption that was leading to the bus error at Commit: 1e5edb9 |
1e5edb9 to
fa4a7d5
Compare
|
@copilot identified that there may be editor codes without the TOOLS_ENABLED define, in this case I found the base_inventory_editor, add it to it and see if you need it in other codes that are in the editor folder. |
- Added TOOLS_ENABLED preprocessor guards to base_inventory_editor.h/cpp - Added TOOLS_ENABLED guards to icon_selector.h/cpp - Added TOOLS_ENABLED guards to item_stack_selector.h/cpp - Added TOOLS_ENABLED guards to resource_id_editor.h/cpp - Ensures editor code is only compiled when building for editor, not in headless exports - All editor files now have consistent TOOLS_ENABLED guards to prevent inclusion in non-editor builds Co-authored-by: scriptsengineer <1673249+scriptsengineer@users.noreply.github.com>
I've added TOOLS_ENABLED guards to base_inventory_editor and all other editor files that were missing them. Found that base_inventory_editor.h/cpp, icon_selector.h/cpp, item_stack_selector.h/cpp, and resource_id_editor.h/cpp were all missing the TOOLS_ENABLED guards. This ensures editor code is only compiled when building for the editor, not in headless exports, which should help prevent editor-specific code from causing issues during headless builds. All editor files now have consistent TOOLS_ENABLED guards and both template_debug and editor builds complete successfully. Commit: c895507 |
This PR fixes a critical bus error/core dump crash that occurs when exporting projects with the inventory system addon in headless mode.
Root Cause
The crash was caused by two related issues:
Signal Registration Issue
The issue occurred because
CraftStationTypesEditorandItemCategoriesEditorinherit fromBaseInventoryEditor(which defines "removed" and "duplicated" signals) but were not properly calling the parent's_bind_methods(). This caused the godot-cpp signal registration system to attempt duplicate registration, corrupting internal class metadata.TOOLS_ENABLED Issue
Several editor files (
base_inventory_editor,icon_selector,item_stack_selector,resource_id_editor) were missing#ifdef TOOLS_ENABLEDguards, allowing editor-specific code to be compiled into headless builds where it shouldn't exist.Technical Details
Using GDB with debug symbols, the crash was traced to:
0x7ffff2392333inlibinventory_system.linux.editor.x86_64.soSIGBUS(Bus error) indicating memory access violationSolution
Fixed Signal Inheritance
Added proper parent
_bind_methods()calls to both editor classes:Added TOOLS_ENABLED Guards
Wrapped all editor files in
#ifdef TOOLS_ENABLEDto ensure editor code is only compiled for editor builds:This comprehensive fix ensures signals are properly inherited from the base class rather than being registered as duplicates, and prevents editor code from being compiled into headless builds where it can cause crashes.
Fixes #237
💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.