From: Enrico Forestieri Date: Tue, 24 Dec 2013 16:21:56 +0000 (+0100) Subject: Fix file dialogs with Qt 5.2.0 and later. X-Git-Tag: 2.1.0rc1~325 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=581400937dd9ab9bbf8bb18f992abc2edbc53ec8;p=features.git Fix file dialogs with Qt 5.2.0 and later. See https://bugreports.qt-project.org/browse/QTBUG-34132 * [QTBUG-34132] QFileDialog does no longer instantiate widgets if a native dialog will be used instead. Therefore some accessors which previously returned unused objects will now return null. As before, you can set the DontUseNativeDialog option to ensure that widgets will be created and used instead. Seemingly, Qt uses native dialogs by default starting from version 5.2.0. When trying to open a file dialog, LyX segfaults in release mode, whereas Qt asserts in debug mode: ASSERT failure in QList::at: "index out of range", file /usr/local/qt/5.2.0/include/QtCore/qlist.h, line 472 This is avoided by explicitly setting the DontUseNativeDialog option in the code path selected by *not* setting USE_NATIVE_FILEDIALOG. This option was introduced in Qt 4.5, which is the minimum required for compiling LyX. So, it is not protected by a preprocessor macro. --- diff --git a/src/frontends/qt4/LyXFileDialog.cpp b/src/frontends/qt4/LyXFileDialog.cpp index 2bc7ba1a03..edb15f0887 100644 --- a/src/frontends/qt4/LyXFileDialog.cpp +++ b/src/frontends/qt4/LyXFileDialog.cpp @@ -51,6 +51,7 @@ LyXFileDialog::LyXFileDialog(QString const & title, { setNameFilters(filters); setWindowTitle(title); + setOption(QFileDialog::DontUseNativeDialog); QList layout = findChildren();