Difference between double click and Open button in QFileDialog
-
wrote on 28 Nov 2011, 12:39 last edited by
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.
-
wrote on 28 Nov 2011, 12:50 last edited by
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?
-
wrote on 28 Nov 2011, 15:16 last edited by
BTW, the problem occurs only on Windows.
The dialog code is quite simple:
[CODE]
QString fileName = QFileDialog::getOpenFileName(this, tr("Open media file"), playerSettings2->prevFileDir, ::mediaDialogFilter);
[/CODE]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...
-
wrote on 28 Nov 2011, 16:19 last edited by
Thread? Hmmm... you are not trying to show a dialog from a different thread than the main GUI thread, are you?
-
wrote on 28 Nov 2011, 16:26 last edited by
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.
-
wrote on 28 Nov 2011, 16:33 last edited by
[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? -
wrote on 28 Nov 2011, 16:41 last edited by
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.
-
wrote on 28 Nov 2011, 17:11 last edited by
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.
4/8