commit 4888414f2757a4e8075dc1f9fec79be30a0fff64
Author: Juergen Spitzmueller <sp...@lyx.org>
Date:   Mon Nov 1 08:30:41 2021 +0100

    Attempt to fix #12226 for good
---
 src/frontends/qt/TocWidget.cpp |    6 +++---
 src/frontends/qt/TocWidget.h   |    2 +-
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/frontends/qt/TocWidget.cpp b/src/frontends/qt/TocWidget.cpp
index 957b3a6..cd346a8 100644
--- a/src/frontends/qt/TocWidget.cpp
+++ b/src/frontends/qt/TocWidget.cpp
@@ -532,11 +532,11 @@ void TocWidget::filterContents()
                activeFilterCO->currentIndex() != 1;
 
        int size = indices.size();
+       QString const matchstring = filter_ ? filter_->text() : QString();
        for (int i = 0; i < size; i++) {
                QModelIndex index = indices[i];
-               bool matches = filter_ &&
-                       index.data().toString().contains(
-                               filter_->text(), Qt::CaseInsensitive);
+               bool matches = index.data().toString().contains(
+                                       matchstring, Qt::CaseInsensitive);
                TocItem const & item =
                        gui_view_.tocModels().currentItem(current_type_, index);
                matches &= (show_active && item.isOutput()) || (show_inactive 
&& !item.isOutput());
diff --git a/src/frontends/qt/TocWidget.h b/src/frontends/qt/TocWidget.h
index 4f8c617..df6c705 100644
--- a/src/frontends/qt/TocWidget.h
+++ b/src/frontends/qt/TocWidget.h
@@ -120,7 +120,7 @@ private:
        // Timer for scheduling expensive update operations
        QTimer * timer_;
        /// Filter bar
-       FancyLineEdit * filter_;
+       FancyLineEdit * filter_ = nullptr;
 };
 
 } // namespace frontend
-- 
lyx-cvs mailing list
lyx-cvs@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-cvs

Reply via email to