Difference between double click and Open button in QFileDialog
Just got a very strange bug when use QFileDialog. If I open files using double click on filename, everything works just fine. But if I select file and then press Open, the first time file is opened correctly, but the second time program hangs. Combining double click and Open doesn't lead to hang. Only two sequential opening using Open causes program hang. Debugging doesn't show any differences between those open variants. Maybe something wrong with threads, but I can't understand what exactly.
Any ideas are highly appreciated. Thanks.
Really strange behaviour, I don't think it is related to the open action. Could you show us some code where the problem is happening?
BTW, the problem occurs only on Windows.
The dialog code is quite simple:
QString fileName = QFileDialog::getOpenFileName(this, tr("Open media file"), playerSettings2->prevFileDir, ::mediaDialogFilter);
But hang occurs later in other libVLC's thread, when it tries to start playback. So, I don't know even where to dig. The only thing changes is the way I work with dialog, so I try to find how double click and pressing Open differ...
Thread? Hmmm... you are not trying to show a dialog from a different thread than the main GUI thread, are you?
I show dialog from main GUI thread, and I don't have any other threads inside application, it's libVLC stuff to create its own threads during playback.
[quote author="trollixx" date="1322497618"]I show dialog from main GUI thread, and I don't have any other threads inside application, it's libVLC stuff to create its own threads during playback.[/quote]
But your dialog should be opened again from your main gui thread.
Is it possible to exclude a problem with libvlc about the opening? I mean, could you dry-run the application without passing the opened file name to the libvlc to see if the dialog still has the strange behavior?
Without libvlc nothing happens after dialog closes. The hang occurs inside libvlc, in one place, but it depends upon the way we use the dialog. So, of course, it seems like bug in libvlc with some depency from QFileDialog behavior. I'm trying now to rebuild app with libvlc from git to see if the bug occurs.
Could it be a problem with the timing you are opening the files? Another trial that comes into my mind is to exclude the open dialog at all and simulate the continue file selection with a cycle, to see if the libvlc cannot handle a rapid file change. Just a thought.