summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJim Raykowski <raykowj@gmail.com>2022-01-17 20:20:18 -0900
committerJim Raykowski <raykowj@gmail.com>2022-01-18 08:30:12 +0100
commit0e7e8bb7ed30cdb1dee7ca72748c742657b19dab (patch)
tree5e7e2066a94be12c9994dbd8014885a6a0efc050
parent078d9da95f6e32965b99248eb61e6e7b859ef150 (diff)
SwNavigator: disallow tracking update when content tree has focus
When document layout has not finished and there is no content to track at the cursor position, e.g. the cursor position is at the start of a document having text before the first heading paragraph, a selection made in the Navigator content tree can automatically unselect. This is not only annoying but causes a crash when action of a choice from the Navigator context menu is dependent on entry selection, e.g. 'Delete', 'Edit', 'Rename'. This patch prevents this annoyance and crash by disallowing content tracking when the content tree or the content tree context menu has focus. Change-Id: I2b0fd1ac4f53571e30ce1efa2934a70de2aad819 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/128520 Tested-by: Jenkins Reviewed-by: Jim Raykowski <raykowj@gmail.com>
-rw-r--r--sw/source/uibase/utlui/content.cxx6
1 files changed, 5 insertions, 1 deletions
diff --git a/sw/source/uibase/utlui/content.cxx b/sw/source/uibase/utlui/content.cxx
index 9f8cfca2e0a2..650c9cdb2686 100644
--- a/sw/source/uibase/utlui/content.cxx
+++ b/sw/source/uibase/utlui/content.cxx
@@ -3682,6 +3682,10 @@ void SwContentTree::UpdateTracking()
if (State::HIDDEN == m_eState || !m_pActiveShell)
return;
+ // only when treeview or treeview context menu does not have focus
+ if (m_xTreeView->has_focus() || m_xTreeView->has_child_focus())
+ return;
+
// m_bIgnoreDocChange is set on delete and outline visibility toggle
if (m_bIgnoreDocChange)
{
@@ -4491,7 +4495,7 @@ void SwContentTree::ExecuteContextMenuAction(const OString& rSelectedPopupEntry)
std::unique_ptr<weld::TreeIter> xFirst(m_xTreeView->make_iterator());
if (!m_xTreeView->get_selected(xFirst.get()))
- xFirst.reset();
+ return; // this shouldn't happen, but better to be safe than ...
auto nSelectedPopupEntry = rSelectedPopupEntry.toUInt32();
switch (nSelectedPopupEntry)