[Libreoffice-commits] core.git: 7 commits - sc/source sd/source sfx2/source svx/source sw/source vcl/source

Caolán McNamara caolanm at redhat.com
Mon Sep 8 01:17:35 PDT 2014


 sc/source/core/data/table3.cxx       |    3 ++-
 sd/source/ui/app/sdmod1.cxx          |   12 +++++-------
 sfx2/source/appl/sfxpicklist.cxx     |    2 +-
 svx/source/form/filtnav.cxx          |   19 +++++++------------
 sw/source/core/docnode/node.cxx      |    2 +-
 vcl/source/uipreviewer/previewer.cxx |   10 +++++++++-
 vcl/source/window/layout.cxx         |    2 ++
 7 files changed, 27 insertions(+), 23 deletions(-)

New commits:
commit 513a3a6a01679046d354f9acc75d98d9e97979db
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Mon Sep 8 08:34:23 2014 +0100

    coverity#704947 Dereference after null check
    
    Change-Id: Id6eb50de48b8a674d7b48d1256b1529637155eb1

diff --git a/sw/source/core/docnode/node.cxx b/sw/source/core/docnode/node.cxx
index 5f490f1..cc73f02 100644
--- a/sw/source/core/docnode/node.cxx
+++ b/sw/source/core/docnode/node.cxx
@@ -990,7 +990,7 @@ void SwCntntNode::Modify( const SfxPoolItem* pOldValue, const SfxPoolItem* pNewV
         break;
 
     case RES_UPDATE_ATTR:
-        if( GetNodes().IsDocNodes() && IsTxtNode() )
+        if (GetNodes().IsDocNodes() && IsTxtNode() && pNewValue)
         {
             const sal_uInt16 nTmp = ((SwUpdateAttr*)pNewValue)->getWhichAttr();
             if ( RES_ATTRSET_CHG == nTmp )
commit d396d5b47876f47b51d3ba42861895e86831738b
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Mon Sep 8 08:24:40 2014 +0100

    coverity#1237357 Uncaught exception
    
    Change-Id: Ie116e0070792c59893ed0b4f41bcf9831400deb9

diff --git a/vcl/source/uipreviewer/previewer.cxx b/vcl/source/uipreviewer/previewer.cxx
index 5bd2d3d..1e318ff 100644
--- a/vcl/source/uipreviewer/previewer.cxx
+++ b/vcl/source/uipreviewer/previewer.cxx
@@ -64,6 +64,8 @@ int UIPreviewApp::Main()
     // turn on tooltips
     Help::EnableQuickHelp();
 
+    int nRet = EXIT_SUCCESS;
+
     try
     {
         Dialog *pDialog = new Dialog(DIALOG_NO_PARENT, WB_STDDIALOG | WB_SIZEABLE);
@@ -93,9 +95,15 @@ int UIPreviewApp::Main()
     catch (const uno::Exception &e)
     {
         fprintf(stderr, "fatal error: %s\n", OUStringToOString(e.Message, osl_getThreadTextEncoding()).getStr());
+        nRet = EXIT_FAILURE;
+    }
+    catch (const std::exception &e)
+    {
+        fprintf(stderr, "fatal error: %s\n", e.what());
+        nRet = EXIT_FAILURE;
     }
 
-    return EXIT_SUCCESS;
+    return nRet;
 }
 
 void vclmain::createApplication()
commit 00212cdb3ee2bb0b4d8fb61a482a7f9f01c0a9b7
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Mon Sep 8 08:21:35 2014 +0100

    coverity#1237355 Dereference null return value
    
    Change-Id: I66956979c494f96f76eb0a7840f28c8edc91d816

diff --git a/sd/source/ui/app/sdmod1.cxx b/sd/source/ui/app/sdmod1.cxx
index cfe75ff..c588a2c 100644
--- a/sd/source/ui/app/sdmod1.cxx
+++ b/sd/source/ui/app/sdmod1.cxx
@@ -652,19 +652,17 @@ SfxFrame* SdModule::ExecuteNewDocument( SfxRequest& rReq )
                         }
 
                         ::sd::DrawDocShell* pDocShell(NULL);
+                        ::sd::ViewShellBase* pBase(NULL);
+                        SdDrawDocument* pDoc(NULL);
                         if (pShell && pViewFrame)
                         {
                             pDocShell = PTR_CAST(::sd::DrawDocShell, pShell);
+                            pDoc = pDocShell ? pDocShell->GetDoc() : NULL;
+                            pBase = ::sd::ViewShellBase::GetViewShellBase(pViewFrame);
                         }
 
-                        if (pDocShell)
+                        if (pDoc && pBase)
                         {
-                           SdDrawDocument* pDoc = pDocShell->GetDoc();
-
-                            ::sd::ViewShellBase* pBase =
-                                  ::sd::ViewShellBase::GetViewShellBase (
-                                      pViewFrame);
-                            assert(pBase!=NULL);
                             ::boost::shared_ptr<sd::ViewShell> pViewSh = pBase->GetMainViewShell();
                             SdOptions* pOptions = GetSdOptions(pDoc->GetDocumentType());
 
commit 2f27dd63d2c1dd36a1df898b72d1d4949ae8230c
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Mon Sep 8 08:12:28 2014 +0100

    coverity#1237351 Logically dead code
    
    Change-Id: Ia82d8d137c5f36cc48826cc851d6f00626e978aa

diff --git a/sfx2/source/appl/sfxpicklist.cxx b/sfx2/source/appl/sfxpicklist.cxx
index 115c954..a416e2e 100644
--- a/sfx2/source/appl/sfxpicklist.cxx
+++ b/sfx2/source/appl/sfxpicklist.cxx
@@ -376,7 +376,7 @@ void SfxPickList::Notify( SfxBroadcaster&, const SfxHint& rHint )
     if ( pEventHint )
     {
         // only ObjectShell-related events with media interest
-        SfxObjectShell* pDocSh = pEventHint ? pEventHint->GetObjShell() : NULL;
+        SfxObjectShell* pDocSh = pEventHint->GetObjShell();
         if( !pDocSh )
             return;
 
commit a30d5cd97336fc8f953fa54f6bfa885b659199a8
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Mon Sep 8 08:10:32 2014 +0100

    coverity#708008 Uninitialized scalar field
    
    Change-Id: I425b1d822d98cbc28a1d99b41379b0dc5d8e6193

diff --git a/sc/source/core/data/table3.cxx b/sc/source/core/data/table3.cxx
index 2bfa71e..2b3294f 100644
--- a/sc/source/core/data/table3.cxx
+++ b/sc/source/core/data/table3.cxx
@@ -269,7 +269,8 @@ public:
         nCount( nInd2 - nInd1 + 1 ), nStart( nInd1 ),
         mnLastIndex(nInd2),
         nUsedSorts(nSorts),
-        mbKeepQuery(false)
+        mbKeepQuery(false),
+        mbUpdateRefs(false)
     {
         if (nUsedSorts)
         {
commit da3ddf32d35f78ce8c9dce2719692570bc5d6034
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Mon Sep 8 08:07:38 2014 +0100

    coverity#1237353 Unchecked dynamic_cast
    
    Change-Id: If25d29eaa788e70972fd0cbbf3d03f4d05862f24

diff --git a/svx/source/form/filtnav.cxx b/svx/source/form/filtnav.cxx
index 828acb1..c5c1c35 100644
--- a/svx/source/form/filtnav.cxx
+++ b/svx/source/form/filtnav.cxx
@@ -1466,29 +1466,25 @@ bool FmFilterNavigator::Select( SvTreeListEntry* pEntry, bool bSelect )
         return false;
 }
 
-
 void FmFilterNavigator::Notify( SfxBroadcaster& /*rBC*/, const SfxHint& rHint )
 {
-    if ( dynamic_cast<const FmFilterInsertedHint*>(&rHint) )
+    if (const FmFilterInsertedHint* pInsertHint = dynamic_cast<const FmFilterInsertedHint*>(&rHint))
     {
-        const FmFilterInsertedHint* pHint = dynamic_cast<const FmFilterInsertedHint*>(&rHint);
-        Insert(pHint->GetData(), pHint->GetPos());
+        Insert(pInsertHint->GetData(), pInsertHint->GetPos());
     }
     else if( dynamic_cast<const FilterClearingHint*>(&rHint) )
     {
         SvTreeListBox::Clear();
     }
-    else if( dynamic_cast<const FmFilterRemovedHint*>(&rHint) )
+    else if (const FmFilterRemovedHint* pRemoveHint = dynamic_cast<const FmFilterRemovedHint*>(&rHint))
     {
-        const FmFilterRemovedHint* pHint = dynamic_cast<const FmFilterRemovedHint*>(&rHint);
-        Remove(pHint->GetData());
+        Remove(pRemoveHint->GetData());
     }
-    else if( dynamic_cast<const FmFilterTextChangedHint*>(&rHint) )
+    else if (const FmFilterTextChangedHint *pChangeHint = dynamic_cast<const FmFilterTextChangedHint*>(&rHint))
     {
-        const FmFilterTextChangedHint* pHint = dynamic_cast<const FmFilterTextChangedHint*>(&rHint);
-        SvTreeListEntry* pEntry = FindEntry(pHint->GetData());
+        SvTreeListEntry* pEntry = FindEntry(pChangeHint->GetData());
         if (pEntry)
-            SetEntryText( pEntry, pHint->GetData()->GetText());
+            SetEntryText( pEntry, pChangeHint->GetData()->GetText());
     }
     else if( dynamic_cast<const FmFilterCurrentChangedHint*>(&rHint) )
     {
@@ -1499,7 +1495,6 @@ void FmFilterNavigator::Notify( SfxBroadcaster& /*rBC*/, const SfxHint& rHint )
     }
 }
 
-
 SvTreeListEntry* FmFilterNavigator::FindEntry(const FmFilterData* pItem) const
 {
     SvTreeListEntry* pEntry = NULL;
commit a7c378f59dc142fb88d65e6c1becaf1cec658bc0
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Sun Sep 7 12:22:20 2014 +0100

    return RET_CANCEL for ui-previewer
    
    Change-Id: Ic175ae730dc67ae28bb52ee503ee5e572bb4cabc

diff --git a/vcl/source/window/layout.cxx b/vcl/source/window/layout.cxx
index 0795ee8..3c71327 100644
--- a/vcl/source/window/layout.cxx
+++ b/vcl/source/window/layout.cxx
@@ -2008,6 +2008,8 @@ short MessageDialog::get_response(const Window *pWindow) const
     std::map<const Window*, short>::const_iterator aFind = m_aResponses.find(pWindow);
     if (aFind != m_aResponses.end())
         return aFind->second;
+    if (!m_pUIBuilder)
+        return RET_CANCEL;
     return m_pUIBuilder->get_response(pWindow);
 }
 


More information about the Libreoffice-commits mailing list