aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Webster <miketwebster@gmail.com>2017-06-20 11:28:09 +0200
committerMike Gabriel <mike.gabriel@das-netzwerkteam.de>2017-06-20 11:28:09 +0200
commitd68171ebaceaa1b6ead605e9cd5bb68c680ccd8a (patch)
treecd7bb215a5ad47c2b905189742a0a2e91328273e
parent29eb6f83f6b9af5635952a3d117e1725ef9439e8 (diff)
downloadarctica-greeter-d68171ebaceaa1b6ead605e9cd5bb68c680ccd8a.tar.gz
arctica-greeter-d68171ebaceaa1b6ead605e9cd5bb68c680ccd8a.tar.bz2
arctica-greeter-d68171ebaceaa1b6ead605e9cd5bb68c680ccd8a.zip
src/prompt-box.vala: Avoid 'pango_layout_get_cursor_pos: assertion 'index >= 0 && index <= layout->length' failed' error.
-rw-r--r--src/prompt-box.vala18
1 files changed, 17 insertions, 1 deletions
diff --git a/src/prompt-box.vala b/src/prompt-box.vala
index 6d5bc13..9901d4f 100644
--- a/src/prompt-box.vala
+++ b/src/prompt-box.vala
@@ -374,7 +374,23 @@ public class PromptBox : FadableBox
public void clear ()
{
prompt_visibility = PromptVisibility.HIDDEN;
- foreach_prompt_widget ((w) => { w.destroy (); });
+
+ /* Hold a ref while removing the prompt widgets -
+ * if we just do w.destroy() we get this warning:
+ * CRITICAL: pango_layout_get_cursor_pos: assertion 'index >= 0 && index <= layout->length' failed
+ * by GtkWidget's screen-changed signal being called on
+ * widget when we destroy it.
+ */
+ foreach_prompt_widget ((w) => {
+#if HAVE_GTK_3_20_0
+ w.ref ();
+ w.get_parent().remove(w);
+ w.unref ();
+#else
+ w.destroy ();
+#endif
+ });
+
reset_last_row ();
has_errors = false;
}