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>
diff --git a/sw/qa/uitest/writer_tests7/tdf156784.py b/sw/qa/uitest/writer_tests7/tdf156784.py
new file mode 100644
index 0000000..5cac8fc
--- /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 f22e0bc..4d69e2a 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 dced56c..59b031c 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 )
{