Skip to content
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

Close organelle menu when leaving cell editor #5775

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

0HyperCube
Copy link
Contributor

@0HyperCube 0HyperCube commented Dec 28, 2024

Brief Description of What This PR Does

Automatically close a modal when the parent is deleted. If the modal is not immediately deleted, then there will be an exception if the modal is closed and the modal manager tries to reparent it back to the now deleted parent.

Related Issues

Closes #4470

Progress Checklist

Note: before starting this checklist the PR should be marked as non-draft.

  • PR author has checked that this PR works as intended and doesn't
    break existing features:
    https://wiki.revolutionarygamesstudio.com/wiki/Testing_Checklist
    (this is important as to not waste the time of Thrive team
    members reviewing this PR)
  • Initial code review passed (this and further items should not be checked by the PR author)
  • Functionality is confirmed working by another person (see above checklist link)
  • Final code review is passed and code conforms to the
    styleguide.

Before merging all CI jobs should finish on this PR without errors, if
there are automatically detected style issues they should be fixed by
the PR author. Merging must follow our
styleguide.

@revolutionary-bot
Copy link

The lead programmer for Thrive is currently on vacation until 2025-01-07. Until then other programmers will try to make pull request reviews, but please be patient if your PR is not getting reviewed.

PRs may be merged after multiple programmers have approved the changes (especially making sure to ensure style guide conformance and gameplay testing are good). If there are no active experienced programmers who can perform merges, PRs may need to wait until the lead programmer is back to be merged.

@dligr dligr requested review from a team December 30, 2024 13:23
@dligr dligr added the review label Dec 30, 2024
@dligr dligr added this to the Release 0.8.1 milestone Dec 30, 2024
@dligr
Copy link
Member

dligr commented Dec 30, 2024

When exiting the editor with the organelle menu open, I get the following exception:

Exception stack trace E 0:00:54:0255 GodotObject.base.cs:78 @ nint Godot.GodotObject.GetPtr(Godot.GodotObject): System.ObjectDisposedException: Cannot access a disposed object. Object name: 'CellEditorComponent'. System.ObjectDisposedException /root/godot/modules/mono/glue/GodotSharp/GodotSharp/Core/GodotObject.base.cs:78 @ nint Godot.GodotObject.GetPtr(Godot.GodotObject) GodotObject.base.cs:78 @ nint Godot.GodotObject.GetPtr(Godot.GodotObject) Node.cs:776 @ void Godot.Node.AddChild(Godot.Node, bool, Godot.Node+InternalMode) NodeHelpers.cs:121 @ void NodeHelpers.ReParent(Godot.Node, Godot.Node) ModalManager.cs:169 @ void ModalManager.UpdateModals() ModalManager.cs:68 @ void ModalManager._Process(double) Node.cs:2395 @ bool Godot.Node.InvokeGodotClassMethod(Godot.NativeInterop.godot_string_name&, Godot.NativeInterop.NativeVariantPtrArgs, Godot.NativeInterop.godot_variant&) NodeWithInput_ScriptMethods.generated.cs:48 @ bool NodeWithInput.InvokeGodotClassMethod(Godot.NativeInterop.godot_string_name&, Godot.NativeInterop.NativeVariantPtrArgs, Godot.NativeInterop.godot_variant&) ModalManager_ScriptMethods.generated.cs:128 @ bool ModalManager.InvokeGodotClassMethod(Godot.NativeInterop.godot_string_name&, Godot.NativeInterop.NativeVariantPtrArgs, Godot.NativeInterop.godot_variant&) CSharpInstanceBridge.cs:24 @ Godot.NativeInterop.godot_bool Godot.Bridge.CSharpInstanceBridge.Call(nint, Godot.NativeInterop.godot_string_name*, Godot.NativeInterop.godot_variant**, int, Godot.NativeInterop.godot_variant_call_error*, Godot.NativeInterop.godot_variant*)

It seems like at the moment of ModalManager re-parenting the organelle menu, the latter's parent (cell editor) is already disposed

@0HyperCube
Copy link
Contributor Author

Thanks for the feedback @dligr. I have updated the code so that all modals are deleted as soon as their parent is deleted. This will stop the exception from occurring again.

@dligr
Copy link
Member

dligr commented Dec 30, 2024

The organelle context menu now correctly closes on editor exit, but an exception is now thrown when exiting with an organelle upgrade popup open.

Stack trace E 0:01:45:0885 GodotObject.base.cs:78 @ nint Godot.GodotObject.GetPtr(Godot.GodotObject): System.ObjectDisposedException: Cannot access a disposed object. Object name: 'CustomConfirmationDialog'. System.ObjectDisposedException /root/godot/modules/mono/glue/GodotSharp/GodotSharp/Core/GodotObject.base.cs:78 @ nint Godot.GodotObject.GetPtr(Godot.GodotObject) GodotObject.base.cs:78 @ nint Godot.GodotObject.GetPtr(Godot.GodotObject) Node.cs:752 @ Godot.StringName Godot.Node.GetName() Node.cs:374 @ Godot.StringName Godot.Node.get_Name() ModalManager.cs:168 @ void ModalManager.UpdateModals() ModalManager.cs:68 @ void ModalManager._Process(double) Node.cs:2395 @ bool Godot.Node.InvokeGodotClassMethod(Godot.NativeInterop.godot_string_name&, Godot.NativeInterop.NativeVariantPtrArgs, Godot.NativeInterop.godot_variant&) NodeWithInput_ScriptMethods.generated.cs:48 @ bool NodeWithInput.InvokeGodotClassMethod(Godot.NativeInterop.godot_string_name&, Godot.NativeInterop.NativeVariantPtrArgs, Godot.NativeInterop.godot_variant&) ModalManager_ScriptMethods.generated.cs:138 @ bool ModalManager.InvokeGodotClassMethod(Godot.NativeInterop.godot_string_name&, Godot.NativeInterop.NativeVariantPtrArgs, Godot.NativeInterop.godot_variant&) CSharpInstanceBridge.cs:24 @ Godot.NativeInterop.godot_bool Godot.Bridge.CSharpInstanceBridge.Call(nint, Godot.NativeInterop.godot_string_name*, Godot.NativeInterop.godot_variant**, int, Godot.NativeInterop.godot_variant_call_error*, Godot.NativeInterop.godot_variant*)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: In progress
Development

Successfully merging this pull request may close these issues.

Exiting the editor while organelle popup is open is possible and crashes the game
3 participants