Gtk3.22: city dialog emergency colour highlighting stops working after city dialog closed and opened again
Various bits of the city dialog get coloured red by
city_dialog_update_information() if something bad is going to happen.
However, in the Gtk3.22 client, this only works the first time the city dialog is opened. If the city dialog is closed and then opened again, emergencies aren't highlighted -- everything remains black regardless.
I'm guessing this is due to the different approach compared to other Gtk clients. There's a static variable holding a
GtkCssProvider, initialised with gtk_css_provider_new() the first time it matters.
I'm guessing the lifetime management is wrong and this thing goes out of scope somehow when the city dialog is destroyed, so the static
emergency_provider is then either useless or invalid.
(Seen on S2_6 and master. Checked Gtk3 is unaffected on both branches.)
#1 Updated by Jacob Nevins 6 months ago
I can't find any documentation about the lifetime of GtkCssProvider objects.
Experimentally, the problem doesn't seem to be that the GtkCssProvider is destroyed with the city dialog, or anything like that... as far as I can tell it hangs around. It's not a floating reference, and adding a g_object_weak_ref I don't see evidence of it being destroyed when the city dialog is closed (or indeed ever).
#2 Updated by Jacob Nevins 6 months ago
- Status changed from New to In Progress
- Assignee set to Jacob Nevins
...oh, but, duh, it's only being added to the widgets that exist when the static GtkCssProvider is first created. The second time round, with fresh widgets, the GtkCssProvider isn't added to them (so the "emergency" style does nothing).
The fix is trivial. (This general approach seems a bit fussy -- we could probably make the "emergency" style available for every widget -- but I'm not going to make a big change now.)