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

only destroy children that aren't re-used #58

Merged
merged 4 commits into from
Aug 25, 2023

Conversation

benthejack-vuw
Copy link
Contributor

@benthejack-vuw benthejack-vuw commented Aug 23, 2023

This is my first PR to an open-source project, let me know if there's anything I need to add/do.

When the children array or child is set on any widget, only widgets that aren't also in the new array should be destroyed.
There may be cases where widgets are being re-used (eg.. images that are created and cached in a service) - destroying them before re-adding them causes errors.

NOTE: I don't know why typescript is complaining that remove_overlay doesn't exist on Overlay widget, it's in the docs.. See commented out code.

Copy link
Owner

@Aylur Aylur left a comment

Choose a reason for hiding this comment

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

Just removing children should be picked up by the garbage collector, but it didn't work for me so I changed it to destroy, but yeah this makes the most sense and works how I wanted it in the first place.

@@ -61,4 +69,9 @@ export default class AgsOverlay extends Gtk.Overlay {
this._overlays.push(widget);
super.add_overlay(widget);
}

remove_overlay(widget: Gtk.Widget): void {
Copy link
Owner

Choose a reason for hiding this comment

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

remove_overlay is a gtk4 thing, not gtk3
you can probably do remove(widget) just like in box

@benthejack-vuw
Copy link
Contributor Author

I'll sort linting and overlay tonight.

@Aylur Aylur merged commit d33a849 into Aylur:main Aug 25, 2023
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants