Skip to content

Keep the System Explorer dock visible during Godot editor shutdown #21

Description

@FootClanSoldier

Summary

When Godot is closed, the System Explorer dock disappears before the editor window itself has finished shutting down.

The dock area is briefly replaced by another built-in dock, such as the Groups panel. This creates a small but noticeable visual flicker during shutdown.

System Explorer should ideally remain visible until the editor window closes.

Current behavior

SystemExplorerPlugin._ExitTree() currently performs the normal dock cleanup immediately:

RemoveDock(_editorDock);
_editorDock.QueueFree();

During a regular editor shutdown, _ExitTree() is called while the Godot editor window is still visible. Removing the dock immediately allows another dock to occupy the same area for the remaining part of the shutdown process.

Expected behavior

During an actual Godot editor shutdown:

  • System Explorer remains visible until the editor window closes.
  • The dock area is not temporarily replaced by another built-in dock.
  • No shutdown warnings or errors are produced.

During normal plugin teardown while the editor continues running:

  • Disabling the plugin must still remove and free the dock.
  • Reloading the C# plugin must not leave an orphaned dock.
  • Re-enabling the plugin must not create duplicate System Explorer docks.

Proposed investigation

Investigate whether Godot 4.6 exposes a reliable way for an EditorPlugin to distinguish between:

  1. The editor application shutting down.
  2. The plugin being disabled or reloaded while the editor remains open.

If a reliable shutdown state can be detected, the plugin could avoid calling RemoveDock(...) during final editor shutdown and allow the editor's own node teardown to destroy the dock together with the rest of the editor UI.

The existing explicit cleanup should remain unchanged for plugin disable and reload operations.

A simple unconditional removal of RemoveDock(...) is not sufficient, because it could cause stale or duplicated docks when the plugin is disabled or reloaded.

Edge cases

The implementation must account for an attempted shutdown being cancelled, for example when Godot displays a dialog for unsaved scenes or resources.

A cancelled shutdown must not leave the plugin in a state where later plugin cleanup is skipped.

Acceptance criteria

  • System Explorer remains visible during a successful Godot editor shutdown until the editor window disappears.
  • No other dock briefly replaces System Explorer during shutdown.
  • Cancelling an editor shutdown leaves System Explorer fully functional.
  • Disabling the plugin removes the System Explorer dock.
  • Re-enabling the plugin creates exactly one System Explorer dock.
  • C# plugin reloads do not leave stale or duplicate docks.
  • No new warnings, errors, invalid-instance accesses, or shutdown exceptions are introduced.
  • Existing Script Editor synchronization teardown continues to run correctly.

Scope

This should be treated as a focused editor-lifecycle polish fix. It should not introduce unrelated dock-management or architectural changes.

Activity

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

Metadata

Metadata

Labels

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions