[Libreoffice-commits] core.git: 2 commits - svx/source

Michael Stahl mstahl at redhat.com
Mon Jan 19 03:43:20 PST 2015


 svx/source/core/extedit.cxx |   30 +++++++++++++++++++++++++-----
 1 file changed, 25 insertions(+), 5 deletions(-)

New commits:
commit 5e4dc857252c8eeaaa629af2fb6b392ab02036cf
Author: Michael Stahl <mstahl at redhat.com>
Date:   Mon Jan 19 12:36:21 2015 +0100

    svx: ExternalToolEdit: don't terminate if SystemShellExecute throws
    
    Change-Id: Ia527a2c9467e2ab097cf688164f4176a52fa1d36

diff --git a/svx/source/core/extedit.cxx b/svx/source/core/extedit.cxx
index b491253..6f6dc2c 100644
--- a/svx/source/core/extedit.cxx
+++ b/svx/source/core/extedit.cxx
@@ -87,9 +87,17 @@ public:
 
 void ExternalToolEditThread::execute()
 {
-    Reference<XSystemShellExecute> xSystemShellExecute(
-        SystemShellExecute::create( ::comphelper::getProcessComponentContext() ) );
-    xSystemShellExecute->execute(m_aFileName, OUString(), SystemShellExecuteFlags::URIS_ONLY);
+    try
+    {
+        Reference<XSystemShellExecute> const xSystemShellExecute(
+            SystemShellExecute::create( ::comphelper::getProcessComponentContext()));
+        xSystemShellExecute->execute(m_aFileName, OUString(),
+                SystemShellExecuteFlags::URIS_ONLY);
+    }
+    catch (uno::Exception const& e)
+    {
+        SAL_WARN("svx", "ExternalToolEditThread: exception: " << e.Message);
+    }
 }
 
 void ExternalToolEdit::Edit(GraphicObject const*const pGraphicObject)
commit c8ae30a720474db8efed3db31348f8ae52c149c3
Author: Michael Stahl <mstahl at redhat.com>
Date:   Mon Jan 19 12:31:03 2015 +0100

    svx: ExternalToolEdit: check that temp file is actually created
    
    Change-Id: I03e49493c549561b4dc806f1e191a73d06733cff

diff --git a/svx/source/core/extedit.cxx b/svx/source/core/extedit.cxx
index 7cc8b5f..b491253 100644
--- a/svx/source/core/extedit.cxx
+++ b/svx/source/core/extedit.cxx
@@ -106,11 +106,23 @@ void ExternalToolEdit::Edit(GraphicObject const*const pGraphicObject)
     OUString aTempFileName;
 
     oslFileHandle pHandle;
-    osl::FileBase::createTempFile(0, &pHandle, &aTempFileBase);
+    osl::FileBase::RC rc =
+        osl::FileBase::createTempFile(0, &pHandle, &aTempFileBase);
+    if (osl::FileBase::E_None != rc)
+    {
+        SAL_WARN("svx", "ExternalToolEdit::Edit: cannot create temp file");
+        return;
+    }
 
     // Move it to a file name with image extension properly set
     aTempFileName = aTempFileBase + "." + OUString(fExtension);
-    osl::File::move(aTempFileBase, aTempFileName);
+    // FIXME: this is pretty stupid, need a better osl temp file API
+    rc = osl::File::move(aTempFileBase, aTempFileName);
+    if (osl::FileBase::E_None != rc)
+    {
+        SAL_WARN("svx", "ExternalToolEdit::Edit: cannot move temp file");
+        return;
+    }
 
     //Write Graphic to the Temp File
     GraphicFilter& rGraphicFilter = GraphicFilter::GetGraphicFilter();


More information about the Libreoffice-commits mailing list