diff options
author | László Németh <nemeth@numbertext.org> | 2023-08-24 16:27:16 +0200 |
---|---|---|
committer | Xisco Fauli <xiscofauli@libreoffice.org> | 2023-09-06 14:08:45 +0200 |
commit | 720d333f4460ea50cad3c32f721e213b36c0140f (patch) | |
tree | 671e865078623e1e6f8c7855e605070e2e0da9e3 | |
parent | fd6fe927666ed9b79636a94eea7226c769099495 (diff) |
tdf#156784 sw tracked table column: fix crash at Select All
Section starting table with hidden deleted first column
freezed at Select All, resulting crash because of infinite
recursion during waiting frame creation of a hidden cell
without frame in Hide Changes mode.
Regression from commit d1004cdd6a445ae73673b0ca360ae034b0ec09f2
"tdf#150673 sw offapi: add change tracking of table column deletion".
Change-Id: I15d9fa0138261d7a95c6e34a8d07fb2e001d0c7d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156056
Tested-by: Jenkins
Reviewed-by: László Németh <nemeth@numbertext.org>
(cherry picked from commit 15639650efb2fa44e96fdc2bd46a64931b9a3329)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156134
Tested-by: László Németh <nemeth@numbertext.org>
(cherry picked from commit 49bfb463aebcfbe3935bc9989d9a1c5689149a09)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156378
Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
Reviewed-by: Ilmari Lauhakangas <ilmari.lauhakangas@libreoffice.org>
Tested-by: Xisco Fauli <xiscofauli@libreoffice.org>
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
-rw-r--r-- | sw/qa/uitest/writer_tests7/tdf156784.py | 38 | ||||
-rw-r--r-- | sw/source/core/crsr/crsrsh.cxx | 9 | ||||
-rw-r--r-- | sw/source/core/frmedt/fetab.cxx | 3 |
3 files changed, 49 insertions, 1 deletions
diff --git a/sw/qa/uitest/writer_tests7/tdf156784.py b/sw/qa/uitest/writer_tests7/tdf156784.py new file mode 100644 index 000000000000..5cac8fc628db --- /dev/null +++ b/sw/qa/uitest/writer_tests7/tdf156784.py @@ -0,0 +1,38 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +from uitest.framework import UITestCase +from uitest.uihelper.common import get_url_for_data_file + +# Bug 156784 - crash fix: Select All in section starting table with hidden first column + +class tdf156784(UITestCase): + def test_tdf156784(self): + with self.ui_test.load_file(get_url_for_data_file("TC-table-del-add.docx")) as self.document: + + xToolkit = self.xContext.ServiceManager.createInstance('com.sun.star.awt.Toolkit') + + # accept all tracked changes + self.xUITest.executeCommand(".uno:AcceptAllTrackedChanges") + + # delete first column + self.xUITest.executeCommand(".uno:DeleteColumns") + + # hide changes + self.xUITest.executeCommand(".uno:ShowTrackedChanges") + + # select cell content + self.xUITest.executeCommand(".uno:SelectAll") + + # This resulted crashing (select section starting table with hidden first column) + self.xUITest.executeCommand(".uno:SelectAll") + + # show changes + self.xUITest.executeCommand(".uno:ShowTrackedChanges") + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/source/core/crsr/crsrsh.cxx b/sw/source/core/crsr/crsrsh.cxx index f22e0bc9450a..4d69e2a6d705 100644 --- a/sw/source/core/crsr/crsrsh.cxx +++ b/sw/source/core/crsr/crsrsh.cxx @@ -77,6 +77,7 @@ #include <view.hxx> #include <hints.hxx> #include <tools/json_writer.hxx> +#include <redline.hxx> using namespace com::sun::star; using namespace util; @@ -2168,6 +2169,14 @@ void SwCursorShell::UpdateCursor( sal_uInt16 eFlags, bool bIdleEnd ) // created, because there used to be a Frame here! if ( !pFrame ) { + // skip, if it is a hidden deleted cell without frame + if ( GetLayout()->IsHideRedlines() ) + { + const SwStartNode* pNd = pShellCursor->GetPointNode().FindTableBoxStartNode(); + if ( pNd && pNd->GetTableBox()->GetRedlineType() == RedlineType::Delete ) + return; + } + do { CalcLayout(); diff --git a/sw/source/core/frmedt/fetab.cxx b/sw/source/core/frmedt/fetab.cxx index dced56c1f2a0..59b031ce772a 100644 --- a/sw/source/core/frmedt/fetab.cxx +++ b/sw/source/core/frmedt/fetab.cxx @@ -1175,7 +1175,8 @@ bool SwFEShell::CanUnProtectCells() const { SwFrame *pFrame = GetCurrFrame(); do { - pFrame = pFrame->GetUpper(); + if ( pFrame ) + pFrame = pFrame->GetUpper(); } while ( pFrame && !pFrame->IsCellFrame() ); if( pFrame ) { |