gtk: Don't add text to GtkTextView until GTK has done initial layout
-
gtk: Remove some unnecessary comments
All GTK functions that allocate memory, and most GLib functions, will either succeed or abort, but will not return NULL: they make no attempt to handle OOM in any way that is more graceful than aborting. This fits well with how Linux normally behaves (overcommitting memory and killing processes if it runs out, rather than returning NULL from malloc()).
This commit doesn't remove all such comments, just the ones near code that I'm about to modify anyway.
-
gtk: Don't add text to GtkTextView until GTK has done initial layout
Pango >= 1.44 sometimes behaves unexpectedly when asked to fit text into a space that is too small to be reasonable: when we give it the amount of space that it previously said was adequate, it will sometimes ask for more space. This leads to GTK 2 going into an infinite loop of redoing the layout (#987587) as the combination of GTK and Pango flaps between two size requests.
It isn't clear whether this is a bug in GTK 2 or Pango or Debconf, but we can dodge it by making sure GTK gets a chance to decide on the layout before we add text, so that initial text wrapping is done at a more reasonable width.
Closes: #988787
This is the other side of gnome-team/gtk2!2 (merged), and I'd be tempted to apply both changes.
When I add both this and gnome-team/gtk2!2 (merged) to a local netinst build, the warnings added by gnome-team/gtk2!2 (merged) go away, indicating that either this or gnome-team/gtk2!2 (merged) would have been sufficient on its own to avoid the relayout loop.
I tested the same two use-cases as on gnome-team/gtk2!2 (merged):
- start installation and choose Sinhala language
- start rescue mode in English and get far enough to open a shell in the installed system