[Libreoffice-commits] core.git: vcl/source

Caolán McNamara caolanm at redhat.com
Tue Nov 25 08:28:50 PST 2014


 vcl/source/window/dialog.cxx |   19 +++++++++++++------
 1 file changed, 13 insertions(+), 6 deletions(-)

New commits:
commit 67fe0b50ede437601e8f5ed90514d729486c6b83
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Tue Nov 25 16:26:51 2014 +0000

    the real bug behind so many apparent crashtest discoveries
    
    the tests are done headless with dbgutil enabled and
    this dialog contents dumped in dbgutil mode tries to
    spit out the contents of the various "file format
    not known", "file busted" dialogs with some bad casts
    and falls over and dies
    
    Change-Id: I353619f0209902d4c099b42064fd48c3c547f846

diff --git a/vcl/source/window/dialog.cxx b/vcl/source/window/dialog.cxx
index 99ceec2..917af60 100644
--- a/vcl/source/window/dialog.cxx
+++ b/vcl/source/window/dialog.cxx
@@ -57,15 +57,22 @@ static OString ImplGetDialogText( Dialog* pDialog )
 {
     OStringBuffer aErrorStr(OUStringToOString(
         pDialog->GetText(), RTL_TEXTENCODING_UTF8));
-    if ( (pDialog->GetType() == WINDOW_MESSBOX) ||
-         (pDialog->GetType() == WINDOW_INFOBOX) ||
-         (pDialog->GetType() == WINDOW_WARNINGBOX) ||
-         (pDialog->GetType() == WINDOW_ERRORBOX) ||
-         (pDialog->GetType() == WINDOW_QUERYBOX) )
+
+    OUString sMessage;
+    if (MessBox* pMessBox = dynamic_cast<MessBox*>(pDialog))
+    {
+        sMessage = pMessBox->GetMessText();
+    }
+    else if (MessageDialog* pMessDialog = dynamic_cast<MessageDialog*>(pDialog))
+    {
+        sMessage = pMessDialog->get_primary_text();
+    }
+
+    if (!sMessage.isEmpty())
     {
         aErrorStr.append(", ");
         aErrorStr.append(OUStringToOString(
-            static_cast<MessBox*>(pDialog)->GetMessText(), RTL_TEXTENCODING_UTF8));
+            sMessage, RTL_TEXTENCODING_UTF8));
     }
     return aErrorStr.makeStringAndClear();
 }


More information about the Libreoffice-commits mailing list