[LyX/master] Fix crash in selection manager

Juergen Spitzmueller spitz at lyx.org
Tue Nov 19 12:33:36 UTC 2019


commit 5d45c10fc785961d7c5f9e1cc291f14a116b1227
Author: Juergen Spitzmueller <spitz at lyx.org>
Date:   Tue Nov 19 13:47:32 2019 +0100

    Fix crash in selection manager
    
    Patch by Patrick De Visschere
---
 src/frontends/qt/GuiSelectionManager.cpp |   10 ++++------
 1 files changed, 4 insertions(+), 6 deletions(-)

diff --git a/src/frontends/qt/GuiSelectionManager.cpp b/src/frontends/qt/GuiSelectionManager.cpp
index 4a735ed..d77acba 100644
--- a/src/frontends/qt/GuiSelectionManager.cpp
+++ b/src/frontends/qt/GuiSelectionManager.cpp
@@ -285,14 +285,14 @@ void GuiSelectionManager::addPB_clicked()
 		return;
 
 	QModelIndex const idxToAdd = selIdx.first();
-	QModelIndex const idx = selectedLV->currentIndex();
 	int const srows = selectedModel->rowCount();
 
 	QMap<int, QVariant> qm = availableModel->itemData(idxToAdd);
 	insertRowToSelected(srows, qm);
 
 	selectionChanged(); //signal
-
+	
+	QModelIndex const idx = selectedLV->currentIndex();
 	if (idx.isValid())
 		selectedLV->setCurrentIndex(idx);
 
@@ -344,8 +344,7 @@ void GuiSelectionManager::upPB_clicked()
 	selectedModel->removeRow(pos);
 	insertRowToSelected(pos - 1, qms);
 
-	selectionChanged(); //signal
-
+	idx = selIdx.first();
 	selectedLV->setCurrentIndex(idx.sibling(idx.row() - 1, idx.column()));
 	selectedHasFocus_ = true;
 	updateHook();
@@ -372,8 +371,7 @@ void GuiSelectionManager::downPB_clicked()
 	selectedModel->removeRow(pos);
 	insertRowToSelected(pos + 1, qms);
 
-	selectionChanged(); //signal
-
+	idx = selIdx.first();
 	selectedLV->setCurrentIndex(idx.sibling(idx.row() + 1, idx.column()));
 	selectedHasFocus_ = true;
 	updateHook();


More information about the lyx-cvs mailing list