[Libreoffice-commits] core.git: Branch 'libreoffice-7-3-4' - sw/source

2022-06-01 Thread Xisco Fauli (via logerrit)
 sw/source/core/layout/atrfrm.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit b44c53bd1c39aacc58987c9f77a1e3d0638da0fc
Author: Xisco Fauli 
AuthorDate: Tue May 31 13:29:00 2022 +0200
Commit: Christian Lohmaier 
CommitDate: Wed Jun 1 22:44:26 2022 +0200

sw: avoid EXCEPTION_INT_DIVIDE_BY_ZERO

See 
https://crashreport.libreoffice.org/stats/signature/SwFormatCol::Calc(unsigned%20short,unsigned%20short)

Change-Id: I79321737b7bed3acff3418d0b51dc6225baaf57f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135184
Reviewed-by: Michael Stahl 
Tested-by: Xisco Fauli 
(cherry picked from commit ea4cd397300120a0f825752182eb3b943eb8a1b2)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135254
Tested-by: Jenkins
Reviewed-by: Xisco Fauli 
(cherry picked from commit 6bbc42687b795b6279b1b96bb721991f90eca4da)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135259
Reviewed-by: Thorsten Behrens 
Reviewed-by: Christian Lohmaier 
Tested-by: Christian Lohmaier 

diff --git a/sw/source/core/layout/atrfrm.cxx b/sw/source/core/layout/atrfrm.cxx
index 4791fda80169..5876f3624c53 100644
--- a/sw/source/core/layout/atrfrm.cxx
+++ b/sw/source/core/layout/atrfrm.cxx
@@ -1065,7 +1065,7 @@ void SwFormatCol::Calc( sal_uInt16 nGutterWidth, 
sal_uInt16 nAct )
 {
 tools::Long nTmp = rCol.GetWishWidth();
 nTmp *= GetWishWidth();
-nTmp /= nAct;
+nTmp = nAct == 0 ? nTmp : nTmp / nAct;
 rCol.SetWishWidth(sal_uInt16(nTmp));
 }
 }


[Libreoffice-commits] core.git: Branch 'libreoffice-7-3-4' - sw/source

2022-06-01 Thread Jim Raykowski (via logerrit)
 sw/source/uibase/utlui/glbltree.cxx |   10 +-
 1 file changed, 5 insertions(+), 5 deletions(-)

New commits:
commit ad55cb3e5550ea92f2aee4bd424065436a900221
Author: Jim Raykowski 
AuthorDate: Mon May 23 15:35:57 2022 -0800
Commit: Thorsten Behrens 
CommitDate: Wed Jun 1 19:10:11 2022 +0200

tdf#149231 Fix crash on print preview of master

caused by commit 1f9a792a391f0811bbb5f570ad5c84d13312c539.

Change-Id: Iecfa019b04b84bb70b5e04af51f9f786d7cd9fdf
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134846
Tested-by: Jenkins
Reviewed-by: Jim Raykowski 
(cherry picked from commit f817b3de1aa827d93e2a622735c4d570514f4849)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134788
Reviewed-by: Michael Stahl 
(cherry picked from commit ee67c82c210ec4bcac0a6e92a13dc63b06006239)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134907
Reviewed-by: Miklos Vajna 
Reviewed-by: Xisco Fauli 
Reviewed-by: Thorsten Behrens 
Tested-by: Thorsten Behrens 

diff --git a/sw/source/uibase/utlui/glbltree.cxx 
b/sw/source/uibase/utlui/glbltree.cxx
index d658a6db7271..45a03e537216 100644
--- a/sw/source/uibase/utlui/glbltree.cxx
+++ b/sw/source/uibase/utlui/glbltree.cxx
@@ -773,7 +773,8 @@ void 
SwGlobalTree::ExecuteContextMenuAction(std::string_view rSelectedPopupEntry
 
 IMPL_LINK_NOARG(SwGlobalTree, Timeout, Timer *, void)
 {
-if (m_pActiveShell && m_pActiveShell->GetView().GetEditWin().HasFocus())
+SwView* pView = GetParentWindow()->GetCreateView();
+if (pView && pView->GetEditWin().HasFocus())
 {
 if (Update(false))
 Display();
@@ -877,14 +878,13 @@ bool SwGlobalTree::Update(bool bHard)
 bool bRet = false;
 if (pActView && pActView->GetWrtShellPtr())
 {
-SwWrtShell* pOldShell = m_pActiveShell;
+const SwWrtShell* pOldShell = m_pActiveShell;
 m_pActiveShell = pActView->GetWrtShellPtr();
 if(m_pActiveShell != pOldShell)
 {
-if (pOldShell)
-EndListening(*pOldShell->GetView().GetDocShell());
-StartListening(*m_pActiveShell->GetView().GetDocShell());
 m_pSwGlblDocContents.reset();
+if (!IsListening(*m_pActiveShell->GetView().GetDocShell()))
+StartListening(*m_pActiveShell->GetView().GetDocShell());
 }
 if(!m_pSwGlblDocContents)
 {


[Libreoffice-commits] core.git: Branch 'libreoffice-7-3-4' - sw/source

2022-06-01 Thread Caolán McNamara (via logerrit)
 sw/source/uibase/sidebar/WriterInspectorTextPanel.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 8d2421f69afead098003eec63c809c2403924b6c
Author: Caolán McNamara 
AuthorDate: Wed Jun 1 11:57:30 2022 +0100
Commit: Christian Lohmaier 
CommitDate: Wed Jun 1 19:06:21 2022 +0200

Resolves: tdf#149408 inspector crash with a writer OLE inside calc

toplevel isn't a SwDocShell at this point, its a ScDocShell

Change-Id: I3aa3c72e494cf6c0ceff1286a7026ca01385ab8e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135173
Reviewed-by: Michael Stahl 
Tested-by: Jenkins
(cherry picked from commit f23faaa44b8bde98bd979032fda9bfce71f7ff96)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135258
Reviewed-by: Xisco Fauli 
Reviewed-by: Christian Lohmaier 
Tested-by: Christian Lohmaier 

diff --git a/sw/source/uibase/sidebar/WriterInspectorTextPanel.cxx 
b/sw/source/uibase/sidebar/WriterInspectorTextPanel.cxx
index 33d2ae6774e0..9ecce3226ac7 100644
--- a/sw/source/uibase/sidebar/WriterInspectorTextPanel.cxx
+++ b/sw/source/uibase/sidebar/WriterInspectorTextPanel.cxx
@@ -65,7 +65,7 @@ 
WriterInspectorTextPanel::WriterInspectorTextPanel(weld::Widget* pParent)
 : InspectorTextPanel(pParent)
 , m_nParIdx(0)
 {
-SwDocShell* pDocSh = static_cast(SfxObjectShell::Current());
+SwDocShell* pDocSh = dynamic_cast(SfxObjectShell::Current());
 m_pShell = pDocSh ? pDocSh->GetWrtShell() : nullptr;
 if (m_pShell)
 {


[Libreoffice-commits] core.git: Branch 'libreoffice-7-3-4' - sw/source

2022-06-01 Thread Xisco Fauli (via logerrit)
 sw/source/core/layout/anchoredobject.cxx |3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

New commits:
commit ac8ca487f7d065fa590eda1d95d7fd75e59cefd1
Author: Xisco Fauli 
AuthorDate: Tue May 31 15:06:53 2022 +0200
Commit: Christian Lohmaier 
CommitDate: Wed Jun 1 19:05:19 2022 +0200

sw: fix crash in SwAnchoredObject::UpdateObjInSortedList

See 
https://crashreport.libreoffice.org/stats/signature/SwAnchoredObject::UpdateObjInSortedList()

Just a few lines above (line 636) the same checks are used inside
the DocumentSettingId::CONSIDER_WRAP_ON_OBJECT_POSITION condition
so I don't understand why they weren't added here as well
Change-Id: Id8ade0a506d5996d9e357d45c20fe56a68a93eec
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135188
Reviewed-by: Miklos Vajna 
Tested-by: Xisco Fauli 
(cherry picked from commit 64f8a70298695d1952c3a399e897755ab861add5)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135170
Tested-by: Jenkins
Reviewed-by: Xisco Fauli 
(cherry picked from commit 15ba58dfb4be1920f562927273cc867eb556a3ec)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135172
Reviewed-by: Michael Stahl 
Reviewed-by: Christian Lohmaier 
Tested-by: Christian Lohmaier 

diff --git a/sw/source/core/layout/anchoredobject.cxx 
b/sw/source/core/layout/anchoredobject.cxx
index 23c1e2f17906..c38cfcb03931 100644
--- a/sw/source/core/layout/anchoredobject.cxx
+++ b/sw/source/core/layout/anchoredobject.cxx
@@ -651,7 +651,8 @@ void SwAnchoredObject::UpdateObjInSortedList()
 AnchorFrame()->GetDrawObjs()->Update( *this );
 // update its position in the sorted object list of its page frame
 // note: as-character anchored object aren't registered at a page frame
-if ( GetFrameFormat().GetAnchor().GetAnchorId() != RndStdIds::FLY_AS_CHAR )
+if ( GetPageFrame() && GetPageFrame()->GetSortedObjs() &&
+GetFrameFormat().GetAnchor().GetAnchorId() != RndStdIds::FLY_AS_CHAR )
 {
 GetPageFrame()->GetSortedObjs()->Update( *this );
 }


[Libreoffice-commits] core.git: Branch 'libreoffice-7-3-4' - sw/source

2022-06-01 Thread Stephan Bergmann (via logerrit)
 sw/source/filter/ww8/docxattributeoutput.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 33e1d55aba6b6f91c056de7ed6c9aff2832782bf
Author: Stephan Bergmann 
AuthorDate: Mon May 23 10:08:08 2022 +0200
Commit: Christian Lohmaier 
CommitDate: Wed Jun 1 19:01:29 2022 +0200

tdf#149198 Fix use of nullptr

...which would have caused std::abort for non-production debug builds since
4f0c70fb5554325e0cc2129741175bf07de22029 "Avoid calling OString ctor with 
null
pointer", and started to erroneously pass a nullptr argument into a
std::string_view for all kinds of builds with
af16aa625682b649e8843237652b9246d519cbae "Improve loplugin:stringview"

Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134758
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 
(cherry picked from commit c8d4ae2ad0cfdac770d897e7aca72fbb4a87765f, plus
follow-up f546767b4e9bf3de288ea50336cf1e15f1ee7435 "tdf#149198 Fix previous
fix")

Change-Id: Iad4d1576ed651a74c0f8b2e8dee3c59f5214accd
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134780
Tested-by: Jenkins
Reviewed-by: Xisco Fauli 
(cherry picked from commit 6f6d61ea5d7700fb18bfb49c6e1d16a55944e581)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134784
Reviewed-by: Michael Stahl 
Reviewed-by: Christian Lohmaier 
Tested-by: Christian Lohmaier 

diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx 
b/sw/source/filter/ww8/docxattributeoutput.cxx
index 6f8a24acd255..a6da6244898a 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -3064,7 +3064,7 @@ void DocxAttributeOutput::WriteCollectedRunProperties()
 {
 const char* pVal = nullptr;
 m_pColorAttrList->getAsChar(FSNS(XML_w, XML_val), pVal);
-if (std::string_view("auto") != pVal)
+if (pVal == nullptr || std::string_view("auto") != pVal)
 {
 m_pSerializer->startElementNS(XML_w14, XML_textFill);
 m_pSerializer->startElementNS(XML_w14, XML_solidFill);


[Libreoffice-commits] core.git: Branch 'libreoffice-7-3-4' - sw/source

2022-06-01 Thread Caolán McNamara (via logerrit)
 sw/source/uibase/misc/redlndlg.cxx |   17 +++--
 1 file changed, 11 insertions(+), 6 deletions(-)

New commits:
commit cd4a3750ca5473f7dc45250f686c75cdc6a59f83
Author: Caolán McNamara 
AuthorDate: Wed Jun 1 11:58:32 2022 +0100
Commit: Christian Lohmaier 
CommitDate: Wed Jun 1 18:56:35 2022 +0200

Related: tdf#149408 various crashes seen in redline panel

with this writer in calc ole case

Change-Id: I1ecd7725703674cc1bcfc9b3d411ec890bfe4bcc
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135238
Tested-by: Jenkins
Reviewed-by: Xisco Fauli 
(cherry picked from commit 31b4e6df39687f4366ff1ac36bb6a727dfa41b10)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135260
Reviewed-by: Christian Lohmaier 
Tested-by: Christian Lohmaier 

diff --git a/sw/source/uibase/misc/redlndlg.cxx 
b/sw/source/uibase/misc/redlndlg.cxx
index b3ca574b492d..e78460dcf410 100644
--- a/sw/source/uibase/misc/redlndlg.cxx
+++ b/sw/source/uibase/misc/redlndlg.cxx
@@ -206,7 +206,8 @@ SwRedlineAcceptDlg::~SwRedlineAcceptDlg()
 
 void SwRedlineAcceptDlg::Init(SwRedlineTable::size_type nStart)
 {
-SwWait aWait( *::GetActiveView()->GetDocShell(), false );
+SwView *pView = ::GetActiveView();
+std::unique_ptr xWait(pView ? new SwWait(*pView->GetDocShell(), 
false) : nullptr);
 weld::TreeView& rTreeView = m_pTable->GetWidget();
 m_aUsedSeqNo.clear();
 
@@ -234,18 +235,19 @@ void SwRedlineAcceptDlg::Init(SwRedlineTable::size_type 
nStart)
 
 void SwRedlineAcceptDlg::InitAuthors()
 {
-SwWrtShell* pSh = ::GetActiveView()->GetWrtShellPtr();
-
 if (!m_xTabPagesCTRL)
 return;
 
+SwView *pView = ::GetActiveView();
+SwWrtShell* pSh = pView ? pView->GetWrtShellPtr() : nullptr;
+
 SvxTPFilter *pFilterPage = m_xTabPagesCTRL->GetFilterPage();
 
 std::vector aStrings;
 OUString sOldAuthor(pFilterPage->GetSelectedAuthor());
 pFilterPage->ClearAuthors();
 
-SwRedlineTable::size_type nCount = pSh->GetRedlineCount();
+SwRedlineTable::size_type nCount = pSh ? pSh->GetRedlineCount() : 0;
 
 m_bOnlyFormatedRedlines = true;
 bool bIsNotFormated = false;
@@ -276,7 +278,7 @@ void SwRedlineAcceptDlg::InitAuthors()
 pFilterPage->SelectAuthor(aStrings[0]);
 
 weld::TreeView& rTreeView = m_pTable->GetWidget();
-bool bEnable = rTreeView.n_children() != 0 && 
!pSh->getIDocumentRedlineAccess().GetRedlinePassword().hasElements();
+bool bEnable = rTreeView.n_children() != 0 && pSh && 
!pSh->getIDocumentRedlineAccess().GetRedlinePassword().hasElements();
 bool bSel = rTreeView.get_selected(nullptr);
 
 rTreeView.selected_foreach([this, pSh, ](weld::TreeIter& 
rEntry){
@@ -705,7 +707,10 @@ void 
SwRedlineAcceptDlg::RemoveParents(SwRedlineTable::size_type nStart, SwRedli
 
 void SwRedlineAcceptDlg::InsertParents(SwRedlineTable::size_type nStart, 
SwRedlineTable::size_type nEnd)
 {
-SwView *pView   = ::GetActiveView();
+SwView *pView = ::GetActiveView();
+if (!pView)
+return;
+
 SwWrtShell* pSh = pView->GetWrtShellPtr();
 bool bHasRedlineAutoFormat = HasRedlineAutoFormat();
 


[Libreoffice-commits] core.git: Branch 'libreoffice-7-3-4' - sw/source

2022-06-01 Thread Miklos Vajna (via logerrit)
 sw/source/uibase/docvw/HeaderFooterWin.cxx |5 +
 1 file changed, 5 insertions(+)

New commits:
commit a8ca3af40324c89ea9ec5f58674ed42bec8ca809
Author: Miklos Vajna 
AuthorDate: Thu May 19 14:17:10 2022 +0200
Commit: Christian Lohmaier 
CommitDate: Wed Jun 1 18:52:41 2022 +0200

sw: fix crash in SwHeaderFooterWin::IsEmptyHeaderFooter()

Crashreport signature:

Fatal signal received: SIGSEGV code: 1 for address: 0x0
program/../program/libswlo.so
SwPageFrame::GetPageDesc() const
sw/source/core/inc/pagefrm.hxx:144
program/../program/libswlo.so
SwHeaderFooterWin::IsEmptyHeaderFooter() const
sw/source/uibase/docvw/HeaderFooterWin.cxx:403
program/../program/libswlo.so
SwHeaderFooterWin::ShowAll(bool)
sw/source/uibase/docvw/HeaderFooterWin.cxx:273
program/../program/libswlo.so
SwFrameControl::ShowAll(bool)
sw/source/uibase/inc/FrameControl.hxx:49

Change-Id: I3c1a6f46c7a15c2ca1a3db69a14d49abbea8c879
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134656
Tested-by: Jenkins
Reviewed-by: Miklos Vajna 
(cherry picked from commit 68da277559597c52833067c1749323ac38f3364a)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134622
Reviewed-by: Xisco Fauli 
(cherry picked from commit 24d8300c1b5a44c4b30c1e062b449df8507d80dc)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134778
Reviewed-by: Michael Stahl 
Reviewed-by: Christian Lohmaier 
Tested-by: Christian Lohmaier 

diff --git a/sw/source/uibase/docvw/HeaderFooterWin.cxx 
b/sw/source/uibase/docvw/HeaderFooterWin.cxx
index d74c25084f14..99cdc0072861 100644
--- a/sw/source/uibase/docvw/HeaderFooterWin.cxx
+++ b/sw/source/uibase/docvw/HeaderFooterWin.cxx
@@ -399,6 +399,11 @@ bool SwHeaderFooterWin::IsEmptyHeaderFooter( ) const
 {
 bool bResult = true;
 
+if (!GetPageFrame())
+{
+return bResult;
+}
+
 // Actually check it
 const SwPageDesc* pDesc = GetPageFrame()->GetPageDesc();