Skip to content

[BUG] Orphaned lambda from sync_complete signal connection causes crash on editor close #99

Closed

Description

@laserless999

Description

On editor close, asset_placer_plugin.gd leaves one orphaned GDScript lambda, which triggers heap corruption and crashes the editor.

Steps to Reproduce

  1. Open a Godot 4.6.2 project with Asset Placer 1.4.0 installed and enabled.

  2. Launch the editor from a terminal with godot --verbose -e.

  3. Close the editor.

  4. Observe output similar to this:

    Unloading addon: res://addons/asset_placer/plugin.cfg
    EditorSettings: Save OK!
    GDScript: 1 orphaned lambdas becoming invalid at destruction of script 'res://addons/asset_placer/asset_placer_plugin.gd'.
    corrupted size vs. prev_size while consolidating
    

Expected Behavior

The editor exits cleanly when closed - no orphaned lambda warnings, no heap corruption messages, no crash.

Actual Behavior

The editor reports an orphaned GDScript lambda belonging to asset_placer_plugin.gd at shutdown, followed by a glibc heap-corruption abort (corrupted size vs. prev_size while consolidating). The process terminates abnormally.

Environment

  • Godot 4.6.2 stable (Arch Linux build, Vulkan Forward+)
  • Asset Placer 1.4.0 (installed from Asset Library)
  • NVIDIA RTX 4080, driver 595.58.03

Additional Context

I first hit this as a reliable crash-on-close in my personal project, which has a fairly heavy plugin stack (GPUTrail, FuncGodot, Godot State Charts, Phantom Camera, Maaack's Game Template, Terrain3D), so I initially assumed it
was a multi-plugin interaction. Bisecting by disabling plugins one at a time pointed at Asset Placer, and reducing to a minimal repro - Asset Placer only on a clean project - still produces the orphaned lambda warning every time. The larger plugin stack just seems to make the fatal form reliable; on the minimal repro the outcome is nondeterministic (sometimes a clean exit, sometimes the heap-corruption crash).

Root Cause

asset_placer_plugin.gd contains exactly one inline lambda - the callback passed to synchronizer.sync_complete.connect(...) inside _enter_tree(). It's also the only signal connection in the file that isn't mirrored by a matching disconnect in _exit_tree(); every other connection
(scene_changed, asset_selected, settings_changed, resources_reimported, and so on) is cleaned up explicitly. Because the lambda outlives the plugin script's destruction, Godot flags it as orphaned, and the dangling reference triggers heap corruption during final cleanup.

This looks like an instance of upstream issue
godotengine/godot#102569

  • orphaned GDScript lambdas bound to script-scoped state crashing at
    shutdown.

Suggested Fix

Extract the lambda into a named method (e.g. _on_sync_complete(added, removed, scanned)) and disconnect it in _exit_tree() alongside the other signal disconnects. That matches the cleanup pattern already used throughout the rest of the file, and 1.4.0's release notes suggest you've been tackling exactly this class of bug - this one just seems to have slipped through.

Activity

  1. Sr3qt commented on Apr 20, 2026

    @Sr3qt
    Contributor

    Thanks for the detailed description and research. I will be posting a PR to fix this shortly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions