Author: mordante
Date: Tue Feb  3 21:22:00 2009
New Revision: 32574

URL: http://svn.gna.org/viewcvs/wesnoth?rev=32574&view=rev
Log:
Fixed an exception in the new dialog.

AI0867 and soliton discovered that the new dialogs sometimes failed with
an exception. The pango markup requires some characters to be escaped so
added the code to do that.

Modified:
    trunk/changelog
    trunk/src/gui/widgets/control.cpp

Modified: trunk/changelog
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/changelog?rev=32574&r1=32573&r2=32574&view=diff
==============================================================================
--- trunk/changelog (original)
+++ trunk/changelog Tue Feb  3 21:22:00 2009
@@ -2,6 +2,8 @@
  * Language and i18n:
    * new translations: Marathi
    * updated translations: British English, Dutch, German, Slovenian
+ * User interface:
+   * Fixed an exception when a certain characters weren't escaped
  * Miscellaneous and bug fixes:
    * Fix flickering of units in the second part of the tutorial (bug #12923)
 

Modified: trunk/src/gui/widgets/control.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/gui/widgets/control.cpp?rev=32574&r1=32573&r2=32574&view=diff
==============================================================================
--- trunk/src/gui/widgets/control.cpp (original)
+++ trunk/src/gui/widgets/control.cpp Tue Feb  3 21:22:00 2009
@@ -407,6 +407,28 @@
        return result.str();
 }
 
+/** escapes a string to be used in a pango formatted string. */
+std::string escape_string(const std::string& str)
+{
+       struct tconverter
+       {
+               tconverter(const std::string& string) 
+                       : str(g_markup_escape_text(string.c_str(), -1))
+               {
+               }
+
+               ~tconverter()
+               {
+                       g_free(str);
+               }
+
+               gchar* str;     
+       };
+
+       tconverter converter(str);
+       return std::string(converter.str);
+}
+
 } // namespace
 
 std::string tcontrol::get_pango_markup() const
@@ -505,7 +527,7 @@
                        }
                }
 
-               line = pre + line + post;
+               line = pre + escape_string(line) + post;
        }
        return utils::join(lines, '\n');
 }


_______________________________________________
Wesnoth-commits mailing list
[email protected]
https://mail.gna.org/listinfo/wesnoth-commits

Reply via email to