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

Get rid of the "disposable" pattern for windows #2101

Merged
merged 8 commits into from
Mar 20, 2019

Conversation

pleroy
Copy link
Member

@pleroy pleroy commented Mar 20, 2019

  • Windows are now constructed with just their supervisor and later initialized with the plugin. This makes it possible to reuse the same window when the plugin gets recreated (e.g., reloaded from a save).
  • Windows are no longer using the "disposable" pattern and are no longer wrapped in a Controlled object. Instead, they use the clear_locks and dispose_windows events to release the locks and unregister themselves at the right place.
  • A bug is fixed whereby locks were not cleared when the main window was hidden.
  • A bit of code reordering to bring related things closer together.

}

~PrincipiaPluginAdapter() {
Cleanup();
Copy link
Member

@eggrobin eggrobin Mar 20, 2019

Choose a reason for hiding this comment

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

The PrincipiaPluginAdapter does have ownership of an unmanaged resource, namely the plugin. It would make sense to destroy it here if it is not IntPtr.Zero (perhaps there are cases where the normal lifecycle of the game is interrupted, and the object finalized without ever going through OnDisable).

@eggrobin eggrobin added the LGTM label Mar 20, 2019
@pleroy pleroy merged commit 619a823 into mockingbirdnest:master Mar 20, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants