]> git.lyx.org Git - features.git/commitdiff
Fix crash in selection manager
authorJuergen Spitzmueller <spitz@lyx.org>
Tue, 19 Nov 2019 12:47:32 +0000 (13:47 +0100)
committerJean-Marc Lasgouttes <lasgouttes@lyx.org>
Thu, 18 Jun 2020 13:48:46 +0000 (15:48 +0200)
Patch by Patrick De Visschere

src/frontends/qt/GuiSelectionManager.cpp

index 4a735ed2d67d9e448403988cc7cde0ee2b661c29..d77acbadc6b773e74ed04a2edb7ca661146174a2 100644 (file)
@@ -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();