diff --git a/news.d/47.2/fixed-call-style-manager-too-early b/news.d/47.2/fixed-call-style-manager-too-early new file mode 100644 index 0000000..05ffa85 --- /dev/null +++ b/news.d/47.2/fixed-call-style-manager-too-early @@ -0,0 +1 @@ +Don't call style manager in application constructor since this is too early. Do it in startup instead. Without this fix, GTK 4.17.0 will terminate the app on startup. diff --git a/src/application.rs b/src/application.rs index b1f6449..de5d361 100644 --- a/src/application.rs +++ b/src/application.rs @@ -56,27 +56,27 @@ mod imp { type ParentType = adw::Application; } - // Overrides GObject vfuncs impl ObjectImpl for LpApplication { fn constructed(&self) { let obj = self.obj(); self.parent_constructed(); - // Force dark theme - obj.style_manager() - .set_color_scheme(adw::ColorScheme::PreferDark); - // Set up the actions obj.setup_actions(); } } - // Overrides GApplication vfuncs impl ApplicationImpl for LpApplication { fn startup(&self) { log::trace!("Startup"); self.parent_startup(); + + // Force dark theme + self.obj() + .style_manager() + .set_color_scheme(adw::ColorScheme::PreferDark); + LpShyBin::ensure_type(); gtk::Window::set_default_icon_name(config::APP_ID); }