Details
-
Bug
-
Resolution: Unresolved
-
P1: Critical
-
None
-
5.12.8
-
None
-
Ubuntu 20
Description
I have written an application that loads files, and saves the path of the loaded file to a settings file so that the application will show the same path next time it is run. The application can be run against multiple settings files.
Because of bug 30913, when I call selectFile() I append "/X" to the path. If I don't append this string, then this bug doesn't occur.
Steps to reproduce:
1) Run application with settings file A, load a file in directory "A", and close the application.
2) Run application with settings file B, load a file in directory "B", and close the application.
3) Run application with settings file A, and open the load file dialog. Directory "A" is correctly shown. Load a file to close the dialog.
4) Open the load file dialog again. Directory "B" is now shown instead of directory "A".
If you skip step 2 then directory "A" is always shown correctly, but if you repeatedly open and close the file dialog then at some point (fairly quickly) the application crashes. The backtrace shows:
#0 __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
#1 0x00007ffff65e0859 in __GI_abort () at abort.c:79
#2 0x00007ffff5d46b43 in ?? () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#3 0x00007ffff5da3cef in g_assertion_message_expr ()
from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#4 0x00007fffeb2d9120 in ?? () from /lib/x86_64-linux-gnu/libgtk-3.so.0
#5 0x00007fffeb23963f in ?? () from /lib/x86_64-linux-gnu/libgtk-3.so.0
#6 0x00007fffeaccbf49 in ?? () from /lib/x86_64-linux-gnu/libgio-2.0.so.0
#7 0x00007fffeaccbf8d in ?? () from /lib/x86_64-linux-gnu/libgio-2.0.so.0
#8 0x00007ffff5d7b04e in g_main_context_dispatch ()
from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#9 0x00007ffff5d7b400 in ?? () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#10 0x00007ffff5d7b4a3 in g_main_context_iteration ()
from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#11 0x00007ffff7069565 in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /lib/x86_64-linux-gnu/libQt5Core.so.5
#12 0x00007ffff70104db in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () from /lib/x86_64-linux-gnu/libQt5Core.so.5
#13 0x00007ffff7018246 in QCoreApplication::exec() ()
from /lib/x86_64-linux-gnu/libQt5Core.so.5
#14 0x000055555558b0ac in main (argc=1, argv=0x7fffffffe658)
at /home/alastair/Work/ReflashLoader/main.cpp:65
I know this isn't very helpful, but it DOES indicate that the problem exists entirely within Qt code and not my application code. The QFileDialog functions should protect against being passed garbage, and once control returns to the event loop, which this shows it has, then it is all Qt code executing.
The code to create the dialog is as follows:
QStringList filters;
filters << "Hex files (.hex)" << "EBN files (.ebn)";
m_file_dlg.setAcceptMode(QFileDialog::AcceptOpen);
m_file_dlg.setFileMode(QFileDialog::ExistingFile);
// On Linux, merely appending a / still leaves us looking at the desired directory /from the parent directory,
// rather than looking at the files in the desired directory.
m_file_dlg.selectFile(m_ui->txtPath->text() + "/X");
m_file_dlg.setNameFilters(filters);
QObject::connect(&m_file_dlg, SIGNAL(fileSelected(const QString &)),
this, SLOT(when_FileSelected(const QString &)));
m_file_dlg.show();