GNOME Bugzilla – Bug 668203
Prevent unreasonable GtkApplication property changes
Last modified: 2018-02-10 04:38:10 UTC
We should restrict the time at which certain properties can change on applications and application windows: - it should not be possible to change the application associated with a window after it has been realized - it should not be possible to call set_app_menu() or set_menubar() after windows have been created and associated with the app
Created attachment 205557 [details] [review] Add restrictions to GtkApplication - 'application' property cannot be changed on realized windows - 'app-menu' and 'menubar' property cannot be changed if the application has windows associated with it (but the content of the menus themselves can change).
Created attachment 205558 [details] [review] Don't call set_application() in gtk_window_realize This call has no effect and with the newly-added restrictions it's violating the set-application-after-realized rule.
Review of attachment 205558 [details] [review]: Makes sense.
Comment on attachment 205558 [details] [review] Don't call set_application() in gtk_window_realize Attachment 205558 [details] pushed as ba9546f - Don't call set_application() in gtk_window_realize
Review of attachment 205557 [details] [review]: All these restrictions look fine to me - have you spot-checked any GtkApplication users for violations ? ::: gtk/gtkapplication.c @@ +1046,3 @@ + * The application menu must be set before any windows are associated + * with the application. An ideal place to do this is from the + * 'startup' virtual function (or signal) or #GApplication. Could also add an xref to the bloatpad example here, since we do it correctly there now.
< teuf> desrt: hey, just tried your patch adding sanity checks for _set_app_menu, it doesn't catch what gnome-boxes is doing [1] and goes in an infinite loop in the /* keep trying until we get a working name... */ block in gtk_application_x11_publish_menu <@desrt> teuf: clearly we need an extra restriction! <@desrt> "you may not set menus until after you are registered as the primary instance" [1] http://git.gnome.org/browse/gnome-boxes/tree/src/app.vala?id=32045340cd6a232ff55de600f1de9db8d92bf2e4#n110
We're moving to gitlab! As part of this move, we are closing bugs that haven't seen activity in more than 5 years. If this issue is still imporant to you and still relevant with GTK+ 3.22 or master, please consider creating a gitlab issue for it.