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

Fix WorkspaceDocument Leak #1808

Merged
merged 12 commits into from
Jul 17, 2024

Conversation

thecoolwinter
Copy link
Collaborator

@thecoolwinter thecoolwinter commented Jul 14, 2024

Description

Fixes various strong reference cycles throughout the app relating to either WorkspaceDocument, related window controllers, view controllers, or sub-models.

This does not entirely close # 1794. There is still some leaked outline view cells that are strongly referencing workspace files (no idea why).
After updating CESE, CodeFileDocument is no longer strongly referenced. There is still an issue with the project navigator's cells staying alive after the window closing but I think this PR is substantial enough to merge now.

Substantial changes:

  • Modified the commands registry api to get rid of some unnecessary wrapping of callbacks.
  • Modified the StandardTableViewCell to use the built-in label and icon properties, and adding the secondary label on top of NSTableViewCell.
  • ExtensionDiscovery slightly reworked to better support cancellation of tasks.
  • Changed to using performClose over close on window objects (this will animate the close button being pressed, and is what should be used in window commands).
  • Added a new property wrapper: @UpdatingWindowController that weakly references and auto-updates a window controller variable. Useful in SwiftUI views or commands that need updating access to the current window controller.

Note

For reviewers, this has a lot of small changes, but there should be no functionality changes.

Related Issues

Checklist

  • I read and understood the contributing guide as well as the code of conduct
  • The issues this PR addresses are related to each other
  • My changes generate no new warnings
  • My code builds and runs on my machine
  • My changes are all related to the related issue above
  • I documented my code

Screenshots

N/A. No UI changes.

@thecoolwinter thecoolwinter marked this pull request as ready for review July 14, 2024 16:05
@thecoolwinter thecoolwinter added P1 This is a high-priority issue and removed P1 This is a high-priority issue labels Jul 14, 2024
@thecoolwinter
Copy link
Collaborator Author

@austincondiff updated to have no force unwraps. Also after merging the CESE changes the last reference to CodeFileDocument is fixed. See comment for more details.

austincondiff
austincondiff previously approved these changes Jul 15, 2024
tom-ludwig
tom-ludwig previously approved these changes Jul 16, 2024
Copy link
Member

@tom-ludwig tom-ludwig left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

0xWDG
0xWDG previously approved these changes Jul 16, 2024
@thecoolwinter
Copy link
Collaborator Author

@FastestMolasses @activcoding @0xWDG sorry need another review, had a merge conflict. I addressed the comments left earlier.

@thecoolwinter thecoolwinter merged commit a73d2e5 into CodeEditApp:main Jul 17, 2024
2 checks passed
@austincondiff austincondiff added the bug Something isn't working label Jul 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working workspace
Projects
None yet
Development

Successfully merging this pull request may close these issues.

🐞 CodeFileDocument Not Releasing Correctly
5 participants