[Libreoffice-commits] .: Branch 'libreoffice-3-6-0' - desktop/source

Michael Stahl mst at kemper.freedesktop.org
Wed Jul 25 02:31:06 PDT 2012


 desktop/source/app/sofficemain.cxx |   22 ++++++++++++++++++++--
 1 file changed, 20 insertions(+), 2 deletions(-)

New commits:
commit 199ebb3431f85d1d1ee40c698c19f14d57279729
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Wed Jul 25 10:31:21 2012 +0200

    Related fdo#51252: Report uncaught exceptions with MessageBox on Windows
    
    ...as stderr is not generally visible there to the user (and vcl's
    Application::ShowNativeErrorBox might not yet be functional during early start
    up).
    
    Change-Id: I1b99a77f7add967579d726462aa0a7b83a5d2d0a
    Signed-off-by: Fridrich Å trba <fridrich.strba at bluewin.ch>
    (cherry picked from commit c794788fb0d28cbd1f8bb6be50198264b3427fc2)
    
    Signed-off-by: Michael Meeks <michael.meeks at suse.com>
    Signed-off-by: Michael Stahl <mstahl at redhat.com>

diff --git a/desktop/source/app/sofficemain.cxx b/desktop/source/app/sofficemain.cxx
old mode 100644
new mode 100755
index 93081b9..a0fba04
--- a/desktop/source/app/sofficemain.cxx
+++ b/desktop/source/app/sofficemain.cxx
@@ -26,6 +26,7 @@
  *
  ************************************************************************/
 
+#include "sal/config.h"
 
 #include "desktopdllapi.h"
 
@@ -37,14 +38,21 @@
 #include <rtl/bootstrap.hxx>
 #include <tools/extendapplicationenvironment.hxx>
 
+#if defined WNT
+#define WIN32_LEAN_AND_MEAN
+#include <windows.h>
+#endif
+
 int SVMain();
 
 // -=-= main() -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
 
 extern "C" int DESKTOP_DLLPUBLIC soffice_main()
 {
-#if defined(ANDROID)
+#if defined ANDROID || defined WNT
     try {
+#endif
+#if defined(ANDROID)
         rtl::Bootstrap::setIniFilename(
                 rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("file:///assets/program/lofficerc")));
 #endif
@@ -75,10 +83,20 @@ extern "C" int DESKTOP_DLLPUBLIC soffice_main()
     }
 #endif
     return SVMain();
-#ifdef ANDROID
+#if defined ANDROID || defined WNT
     } catch (const ::com::sun::star::uno::Exception &e) {
+#if defined ANDROID
         fprintf (stderr, "Not handled UNO exception at main: '%s'\n",
                  rtl::OUStringToOString(e.Message, RTL_TEXTENCODING_UTF8).getStr());
+#elif defined WNT
+        MessageBoxW(
+            0,
+            reinterpret_cast< LPCWSTR >(
+                rtl::OUString("Unhandled exception:\n" + e.Message).getStr()),
+            reinterpret_cast< LPCWSTR >(rtl::OUString("Fatal Error").getStr()),
+            (MB_OK | MB_ICONERROR | MB_DEFBUTTON1 | MB_TASKMODAL
+             | MB_SETFOREGROUND | MB_TOPMOST));
+#endif
         throw; // to get exception type printed
     }
 #endif


More information about the Libreoffice-commits mailing list