commit 581400937dd9ab9bbf8bb18f992abc2edbc53ec8
Author: Enrico Forestieri <[email protected]>
Date:   Tue Dec 24 17:21:56 2013 +0100

    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<T>::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 2bc7ba1..edb15f0 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<QHBoxLayout *> layout = findChildren<QHBoxLayout *>();
 

Reply via email to