[Libreoffice-commits] core.git: 8 commits - lotuswordpro/source vcl/inc vcl/source
Caolán McNamara
caolanm at redhat.com
Sat Dec 19 04:54:53 PST 2015
lotuswordpro/source/filter/lwpfrib.cxx | 4 +-
lotuswordpro/source/filter/lwpfribsection.cxx | 44 +++++++++++++++-----------
lotuswordpro/source/filter/lwppara.cxx | 2 -
lotuswordpro/source/filter/xfilter/xfcell.cxx | 2 -
vcl/inc/window.h | 2 -
vcl/source/window/event.cxx | 6 +--
vcl/source/window/window.cxx | 1
7 files changed, 37 insertions(+), 24 deletions(-)
New commits:
commit 960cfb7e3ba56fe06f45c523e086ee6d4b95e685
Author: Caolán McNamara <caolanm at redhat.com>
Date: Sat Dec 19 12:45:57 2015 +0000
1343630 Dereference after null check
Change-Id: I81223b868f069755e8a46c57bfe0282021f26de7
diff --git a/lotuswordpro/source/filter/lwppara.cxx b/lotuswordpro/source/filter/lwppara.cxx
index 725b914..7cd676c 100644
--- a/lotuswordpro/source/filter/lwppara.cxx
+++ b/lotuswordpro/source/filter/lwppara.cxx
@@ -305,7 +305,7 @@ void LwpPara::XFConvert(XFContentContainer* pCont)
m_Fribs.SetXFPara(pPara);
m_Fribs.XFConvert();
- if (m_pBreaks)
+ if (m_pBreaks && m_pXFContainer)
AddBreakAfter(m_pXFContainer);
}
commit 274d265e42ab89be29af21ef5cc1cbf20b3d35a2
Author: Caolán McNamara <caolanm at redhat.com>
Date: Sat Dec 19 12:45:06 2015 +0000
coverity#1343629 Unchecked dynamic_cast
Change-Id: I93b7298d785e57a4ef854cea3e9cd5c2c0f35849
diff --git a/lotuswordpro/source/filter/lwpfribsection.cxx b/lotuswordpro/source/filter/lwpfribsection.cxx
index 33ceeb9..a6ad875 100644
--- a/lotuswordpro/source/filter/lwpfribsection.cxx
+++ b/lotuswordpro/source/filter/lwpfribsection.cxx
@@ -190,7 +190,7 @@ void LwpFribSection::SetDefaultAlphaIndex(XFIndex * pXFIndex)
LwpIndexSection* pIndexSection = dynamic_cast<LwpIndexSection*>(m_Section.obj().get());
XFIndexTemplate * pTemplateSep = new XFIndexTemplate();
- if (pIndexSection->IsFormatSeparator())
+ if (pIndexSection && pIndexSection->IsFormatSeparator())
{
pXFIndex->SetSeparator(true);
pTemplateSep->AddEntry(enumXFIndexTemplateText,"");
@@ -216,7 +216,7 @@ void LwpFribSection::SetDefaultAlphaIndex(XFIndex * pXFIndex)
pTemplate3->AddEntry(enumXFIndexTemplateTab,"");
pTemplate3->AddEntry(enumXFIndexTemplatePage,"");
- if (pIndexSection->IsFormatRunin())
+ if (pIndexSection && pIndexSection->IsFormatRunin())
{
//pXFIndex->AddTemplate(OUString::number(2),"Primary",pTemplate2);
//pXFIndex->AddTemplate(OUString::number(3),"Primary",pTemplate3);
commit 1276f6daf28f61d911da9885e0cac738931e4de4
Author: Caolán McNamara <caolanm at redhat.com>
Date: Sat Dec 19 12:43:43 2015 +0000
coverity#1343627 Unchecked dynamic_cast
Change-Id: I83c0febcbbf0f19a05818e0575921d1d6254935f
diff --git a/lotuswordpro/source/filter/lwpfrib.cxx b/lotuswordpro/source/filter/lwpfrib.cxx
index 2c69886..230437b 100644
--- a/lotuswordpro/source/filter/lwpfrib.cxx
+++ b/lotuswordpro/source/filter/lwpfrib.cxx
@@ -253,11 +253,13 @@ void LwpFrib::RegisterStyle(LwpFoundry* pFoundry)
}
if (pNamedStyle)
{
+ LwpCharacterStyle* pCharStyle = nullptr;
if (m_pModifiers->FontID && pFoundry)
+ pCharStyle = dynamic_cast<LwpCharacterStyle*>(m_pModifiers->CharStyleID.obj().get());
+ if (pCharStyle)
{
pStyle = new XFTextStyle();
*pStyle = *pNamedStyle;
- LwpCharacterStyle* pCharStyle = dynamic_cast<LwpCharacterStyle*>(m_pModifiers->CharStyleID.obj().get());
pStyle->SetStyleName("");
pFont = pFoundry->GetFontManger().CreateOverrideFont(pCharStyle->GetFinalFontID(),m_pModifiers->FontID);
commit c2f1731685014b9df386dfb59900783c3ca3acb7
Author: Caolán McNamara <caolanm at redhat.com>
Date: Sat Dec 19 12:40:50 2015 +0000
coverity#1343626 Unchecked dynamic_cast
Change-Id: I52e6d6c9cb48880185293fb9825d7a6530ee767d
diff --git a/lotuswordpro/source/filter/lwpfribsection.cxx b/lotuswordpro/source/filter/lwpfribsection.cxx
index 1a38e07..33ceeb9 100644
--- a/lotuswordpro/source/filter/lwpfribsection.cxx
+++ b/lotuswordpro/source/filter/lwpfribsection.cxx
@@ -245,9 +245,12 @@ LwpMasterPage::LwpMasterPage(LwpPara* pPara, LwpPageLayout* pLayout)
bool LwpMasterPage::RegisterMasterPage(LwpFrib* pFrib)
{
//if there is no other frib after current frib, register master page in starting para of next page
- if(IsNextPageType()&&(!pFrib->HasNextFrib()))
+ LwpStory* pStory = nullptr;
+ if (IsNextPageType()&&(!pFrib->HasNextFrib()))
+ pStory = dynamic_cast<LwpStory*>(m_pPara->GetStoryID().obj().get());
+
+ if (pStory)
{
- LwpStory* pStory = dynamic_cast<LwpStory*>(m_pPara->GetStoryID().obj().get());
pStory->SetCurrentLayout(m_pLayout);
RegisterFillerPageStyle();
return false;
@@ -278,14 +281,17 @@ bool LwpMasterPage::RegisterMasterPage(LwpFrib* pFrib)
case LwpLayout::StartOnOddPage: //fall through
case LwpLayout::StartOnEvenPage:
{
- LwpStory* pStory = dynamic_cast<LwpStory*>(m_pPara->GetStoryID().obj().get());
- pStory->SetCurrentLayout(m_pLayout);
- //get odd page layout when the current pagelayout is mirror
- m_pLayout = pStory->GetCurrentLayout();
- m_bNewSection = IsNeedSection();
- //bSectionColumns = m_bNewSection;
- pOverStyle->SetMasterPage( m_pLayout->GetStyleName());
- RegisterFillerPageStyle();
+ pStory = dynamic_cast<LwpStory*>(m_pPara->GetStoryID().obj().get());
+ if (pStory)
+ {
+ pStory->SetCurrentLayout(m_pLayout);
+ //get odd page layout when the current pagelayout is mirror
+ m_pLayout = pStory->GetCurrentLayout();
+ m_bNewSection = IsNeedSection();
+ //bSectionColumns = m_bNewSection;
+ pOverStyle->SetMasterPage( m_pLayout->GetStyleName());
+ RegisterFillerPageStyle();
+ }
break;
}
default:
@@ -293,7 +299,10 @@ bool LwpMasterPage::RegisterMasterPage(LwpFrib* pFrib)
}
//register tab style;
- LwpStory* pStory = dynamic_cast<LwpStory*>(m_pPara->GetStoryID().obj().get());
+ pStory = dynamic_cast<LwpStory*>(m_pPara->GetStoryID().obj().get());
+ if (!pStory)
+ return false;
+
pStory->SetTabLayout(m_pLayout);
m_pPara->RegisterTabStyle(pOverStyle);
@@ -305,7 +314,7 @@ bool LwpMasterPage::RegisterMasterPage(LwpFrib* pFrib)
XFSectionStyle* pSectStyle= new XFSectionStyle();
//set margin
pStory = dynamic_cast<LwpStory*>(m_pPara->GetStoryID().obj().get());
- if(pStory)
+ if (pStory)
{
LwpPageLayout* pCurrentLayout = pStory->GetCurrentLayout();
double fLeft = m_pLayout->GetMarginsValue(MARGIN_LEFT)- pCurrentLayout->GetMarginsValue(MARGIN_LEFT);
commit 9e83e31019cdc68e5324a10ef76417b46720cfe9
Author: Caolán McNamara <caolanm at redhat.com>
Date: Sat Dec 19 12:37:25 2015 +0000
coverity#1343625 Unchecked dynamic_cast
Change-Id: Ib534e4e8ecf50a9159c5e98e2c899bf13f44c654
diff --git a/lotuswordpro/source/filter/lwpfribsection.cxx b/lotuswordpro/source/filter/lwpfribsection.cxx
index 591ed4a..1a38e07 100644
--- a/lotuswordpro/source/filter/lwpfribsection.cxx
+++ b/lotuswordpro/source/filter/lwpfribsection.cxx
@@ -338,7 +338,7 @@ bool LwpMasterPage::IsNeedSection()
//get story
LwpStory* pStory = dynamic_cast<LwpStory*>(m_pPara->GetStoryID().obj().get());
//if pagelayout is modified, register the pagelayout
- if(pStory->IsPMModified())
+ if (pStory && pStory->IsPMModified())
{
bNewSection = pStory->IsNeedSection();
}
commit 26fddc3196c7ab932ada544b84b74da06fa2596d
Author: Caolán McNamara <caolanm at redhat.com>
Date: Sat Dec 19 12:35:43 2015 +0000
coverity#1343624 Unchecked dynamic_cast
Change-Id: Ia303a5dc97fb5e491e86a3484040e657f1b480d4
diff --git a/lotuswordpro/source/filter/lwpfribsection.cxx b/lotuswordpro/source/filter/lwpfribsection.cxx
index d6ee8a5..591ed4a 100644
--- a/lotuswordpro/source/filter/lwpfribsection.cxx
+++ b/lotuswordpro/source/filter/lwpfribsection.cxx
@@ -395,12 +395,13 @@ void LwpMasterPage::ParseSection(LwpFrib* pFrib)
pCurrContainer->RemoveLastContent();
}
}
- pStory->AddXFContent( pContent );
+ if (pStory)
+ pStory->AddXFContent( pContent );
}
else
{
LwpStory* pStory = dynamic_cast<LwpStory*> ( m_pPara->GetStoryID().obj().get() );
- pContent = pStory->GetXFContent();
+ pContent = pStory ? pStory->GetXFContent() : nullptr;
}
if(pContent)
{
commit 8f3c796ecf926f81f6229fbb040095286c8adbfe
Author: Caolán McNamara <caolanm at redhat.com>
Date: Sat Dec 19 12:34:34 2015 +0000
coverity#1343623 Logically dead code
Change-Id: Ibcf05263f7bea50f70d55f4d8944d0a41d54851d
diff --git a/lotuswordpro/source/filter/xfilter/xfcell.cxx b/lotuswordpro/source/filter/xfilter/xfcell.cxx
index 94c696f..2a81548 100644
--- a/lotuswordpro/source/filter/xfilter/xfcell.cxx
+++ b/lotuswordpro/source/filter/xfilter/xfcell.cxx
@@ -99,7 +99,7 @@ void XFCell::Add(XFContent *pContent)
}
if( pContent->GetContentType() == enumXFContentTable )
{
- XFTable *pTable = static_cast<XFTable*>(pContent);
+ XFTable *pTable = dynamic_cast<XFTable*>(pContent);
if( !pTable )
return;
//the sub table will fill all the cell, there can't be other contents.
commit d14b4a6b874e46fbb1434e523a1ffd993e5c9d44
Author: Caolán McNamara <caolanm at redhat.com>
Date: Sat Dec 19 12:32:24 2015 +0000
coverity#1028600 Uninitialized scalar field
Change-Id: I0b4ee14ea2306786351ce20960a05e8f3058fb21
diff --git a/vcl/inc/window.h b/vcl/inc/window.h
index e950369..184c7a9 100644
--- a/vcl/inc/window.h
+++ b/vcl/inc/window.h
@@ -232,7 +232,7 @@ public:
VclPtr<vcl::Window> mpDlgCtrlDownWindow;
std::vector<Link<VclWindowEvent&,void>> maEventListeners;
std::vector<Link<VclWindowEvent&,void>> maChildEventListeners;
- int maChildEventListenersIteratingCount;
+ int mnChildEventListenersIteratingCount;
std::set<Link<VclWindowEvent&,void>> maChildEventListenersDeleted;
// The canvas interface for this VCL window. Is persistent after the first GetCanvas() call
diff --git a/vcl/source/window/event.cxx b/vcl/source/window/event.cxx
index c001c7e..85da86c 100644
--- a/vcl/source/window/event.cxx
+++ b/vcl/source/window/event.cxx
@@ -245,11 +245,11 @@ void Window::CallEventListeners( sal_uLong nEvent, void* pData )
// Copy the list, because this can be destroyed when calling a Link...
std::vector<Link<VclWindowEvent&,void>> aCopy( rWindowImpl.maChildEventListeners );
// we use an iterating counter/flag and a set of deleted Link's to avoid O(n^2) behaviour
- rWindowImpl.maChildEventListenersIteratingCount++;
+ rWindowImpl.mnChildEventListenersIteratingCount++;
comphelper::ScopeGuard aGuard(
[&rWindowImpl]()
{
- if (--rWindowImpl.maChildEventListenersIteratingCount == 0)
+ if (--rWindowImpl.mnChildEventListenersIteratingCount == 0)
rWindowImpl.maChildEventListenersDeleted.clear();
}
);
@@ -302,7 +302,7 @@ void Window::RemoveChildEventListener( const Link<VclWindowEvent&,void>& rEventL
{
auto& rListeners = mpWindowImpl->maChildEventListeners;
rListeners.erase( std::remove(rListeners.begin(), rListeners.end(), rEventListener ), rListeners.end() );
- if (mpWindowImpl->maChildEventListenersIteratingCount)
+ if (mpWindowImpl->mnChildEventListenersIteratingCount)
mpWindowImpl->maChildEventListenersDeleted.insert(rEventListener);
}
}
diff --git a/vcl/source/window/window.cxx b/vcl/source/window/window.cxx
index cbfcc37..cc8973d 100644
--- a/vcl/source/window/window.cxx
+++ b/vcl/source/window/window.cxx
@@ -631,6 +631,7 @@ WindowImpl::WindowImpl( WindowType nType )
mpNextOverlap = nullptr; // next overlap window of frame
mpLastFocusWindow = nullptr; // window for focus restore
mpDlgCtrlDownWindow = nullptr; // window for dialog control
+ mnChildEventListenersIteratingCount = 0;
mpFirstDel = nullptr; // Dtor notification list
mpUserData = nullptr; // user data
mpCursor = nullptr; // cursor
More information about the Libreoffice-commits
mailing list