-
-
Notifications
You must be signed in to change notification settings - Fork 67
Some Vala things #1429
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
base: main
Are you sure you want to change the base?
Some Vala things #1429
Conversation
Apparently, Vala has been doing this for us since 2014, see https://gitlab.gnome.org/GNOME/vala/-/commit/8f9979da7a75cb91a46e47e61bf35a41c8ff8083 Signed-off-by: Sergey Bugaev <[email protected]>
See https://gitlab.gnome.org/GNOME/vala/-/commit/7d405900242ff5ef96abe7b117ec4e65dc058858 Signed-off-by: Sergey Bugaev <[email protected]>
is this something done in a recent release? Because ~half year ago it was still a problem #1170 |
note that I couldn't reliably reproduce the issues #1170 fixed (mostly freezes and crashes when using custom widgets in builder files - specifically the custom emoji picker in the profile editor), but had more than 1 reports about it and it was targeted down after debugging their installations; even if they were flatpaks 🤷 If it's done in a recent release, we might have to check in meson and ensure them behind a flag |
No, it's been doing that since https://gitlab.gnome.org/GNOME/vala/-/commit/8f9979da7a75cb91a46e47e61bf35a41c8ff8083 Maybe there is a Heisenbug in Vala (that I could fix)? How do I reproduce that? |
If I remember correctly, the common reproducer was opening the profile editor (open your profile => pencil headerbar button) without constructing a custom emoji picker prior (e.g. without opening the composer) |
It does so in instance init (below in your screenshot), right before |
Aha, I can reproduce that. It's indeed missing an ensure for (By the way, a thought for another day: it would make more sense to me if in C, these classes only had |
Not opposed to it as long as it doesn't create conflicts (Tuba.API.Account vs Tuba.Widgets.Account); we had enough of them in vala land (GLib.DateTime vs Tuba.DateTime) |
Okay, so I have a Vala branch that fixes this. Other than
Does that match your expectations, or do you know of more instances of missing P.S. https://floss.social/@bugaevc/114556715462967488, any idea? |
Awesome, thanks! Yes I think it's alright, the missing
I think the main problem is that we do keep a reference to the main window under app, you can set it to null on shutdown and it should hit them: diff --git a/src/Application.vala b/src/Application.vala
index d8ba5539..50add463 100644
--- a/src/Application.vala
+++ b/src/Application.vala
@@ -391,6 +391,7 @@ namespace Tuba {
#endif
network.flush_cache ();
+ app.main_window = null;
base.shutdown ();
}
|
Maybe I should write a more graceful shutdown process... |
I did this instead: diff --git a/src/Application.vala b/src/Application.vala
index d8ba5539..8e2dc82e 100644
--- a/src/Application.vala
+++ b/src/Application.vala
@@ -32,7 +32,7 @@ namespace Tuba {
public class Application : Adw.Application {
public GLib.ProxyResolver? proxy { get; set; default=null; }
- public Dialogs.MainWindow? main_window { get; set; }
+ public unowned Dialogs.MainWindow? main_window { get; set; }
public Dialogs.NewAccount? add_account_window { get; set; }
public bool is_mobile { get; set; default=false; }
public bool is_online { get; private set; default=true; }
diff --git a/src/Dialogs/MainWindow.vala b/src/Dialogs/MainWindow.vala
index bf8e96c6..1ad4bbd6 100644
--- a/src/Dialogs/MainWindow.vala
+++ b/src/Dialogs/MainWindow.vala
@@ -261,4 +261,11 @@ public class Tuba.Dialogs.MainWindow: Adw.ApplicationWindow, Saveable {
last_view = view;
}
+
+ public override void dispose () {
+ if (app.main_window == this) {
+ app.main_window = null;
+ }
+ base.dispose ();
+ }
} Could've also used |
I'm surprised about the
g_type_ensure
thing. I remember having to add one of those lines myself, so now I got the idea that I should teach Vala to just do it automatically, and turns out it already does, and everything seems to just work without them indeed.