istring: fix istring_prepend() on malloc transition
authorChristian Hergert <chergert@redhat.com>
Tue, 10 Jan 2023 21:32:38 +0000 (13:32 -0800)
committerChristian Hergert <chergert@redhat.com>
Tue, 10 Jan 2023 21:32:38 +0000 (13:32 -0800)
When transitioning from internal to malloc, the strings were placed in
the wrong order to g_strconcat(). This fixes an issue with undo where
if you hit the boundary in just the right way, your undo stack will do
unexpected things.

Fixes #5506

gtk/gtkistringprivate.h

index 9dfe8712f48033053f63300c7a23940aeb1f5dd0..8c642617710b30c6b9e85cbf8d1c0e5ff88dc0f0 100644 (file)
@@ -133,7 +133,7 @@ istring_prepend (IString *str,
       if (!istring_is_inline (str))
         old = str->u.str;
 
-      str->u.str = g_strconcat (istring_str (str), istring_str (other), NULL);
+      str->u.str = g_strconcat (istring_str (other), istring_str (str), NULL);
       str->n_bytes += other->n_bytes;
       str->n_chars += other->n_chars;