[Interest] Annoying Bug - Qt 4.8.1 bug?

Bo Thorsen bthorsen at ics.com
Thu Jan 23 13:22:21 CET 2014


Hi Etienne,

Ok, fair enough.

I just compiled and ran your example with 4.8.5. I don't have 4.8.1 
available anywhere. It ran the save dialog without any crashes.

Looks like you have to upgrade to a newer Qt version. Which you really 
should do anyway. 4.8.1 is *old*.

If upgrading doesn't work, it's something in either mingw or your 
environment. I used VS2010 on 64 bit Win 7. I don't have mingw here, so 
I can't test that.

Bo.

Den 23-01-2014 12:24, Etienne Sandré-Chardonnal skrev:
> Hi Bo,
>
> Thanks for helping, please read my initial post carefully.
>
> 1) I do actually call start(), look at the forelast line of
> BackgroundFileWorker::startWriting, both in the paste code, and in the
> attached zip
> 2) run() is empty here because I have stripped down my app (2Mb of code)
> to make a tiny compilable project reproducing the crash.
>
>
> I can't actually do what you suggest because the file writing is done by
> an external lib written by me, but which should not have Qt
> dependencies. Anyway, that's not the topic here:
>
> In the attached file, I _have reproduced the crash with a very
> minimalist project_, doing no actual work for anything. And it appears
> that_Qt calls a slot of an object after it was destroyed_
>
> So please don't say that the posted code does nothing, because _it does
> nothing_. But it_crashes while apparently nothing illegal was done_.
>
>
> Cheers,
>
> Etienne
>
>
>
>
> 2014/1/23 Bo Thorsen <bthorsen at ics.com <mailto:bthorsen at ics.com>>
>
>     Den 23-01-2014 10:15, Etienne Sandré-Chardonnal skrev:
>      > Dear all,
>      >
>      > I'm tracking a bug since a few days, which happens at the end of file
>      > saving in my app. It saves using a separate thread, while the GUI
>      > displays a modal progress dialog. The app crashes in the
>     QProgressDialog
>      > destructor, and this does not happen all the time. I have double
>     checked
>      > that the destructor is called only once; it's allocated on the
>     heap and
>      > I let Qt destroy it with the flag WA_DeleteOnClose.
>      >
>      > I spent a few hours stripping my app to the bare minimum that
>     keeps it
>      > crashing. The good news is that it's possible to reproduce it with a
>      > small project, the bad is the probability for crashing at each
>     click on
>      > the "save" button decreases when the GUI becomes simple (I had to
>     keep a
>      > few widgets and UI to keep it at a detectable level) but
>     everything is
>      > made with .ui's and generated by Qt, so my code is minimal. You
>     may find
>      > the project attached, I'm running Qt 4.8.1 under win7 64 bit, with
>      > mingw32 and mingw64 (both crash). *To trigger the crash, you need to
>      > click on "Save" toolbutton, then press enter. This needs to be
>     repeated
>      > several times, several varying between 2 and 50.*
>
>     Hi Etienne,
>
>     I took a look at your code, and unfortunately there is a lot wrong
>     with it.
>
>     Your BackgroundFileWorker class does not run the a separate thread. You
>     don't call start() and the run() method is empty so it returns
>     immediately.
>
>     And you don't even need a thread for this. Create the progress dialog
>     and do a loop that does something like this:
>
>     while not done
>         save a chunk
>         update the progress dialog
>         QApplication::processEvents()
>
>     I can guarantee you there is no Qt bug here.
>
>     One thing I would advise you: Stop creating all those objects on the
>     heap. Create them on the stack instead whenever you can. For example,
>     the saveSceneDialog shouldn't be a new SaaveSceneDialog().
>
>     Get rid of the threads and try again.
>
>     Bo.
>
>     --
>     Bo Thorsen, European Engineering Manager, ICS
>     Integrated Computer Solutions. Delivering World-Class Applications
>     http://ics.com/services
>     _______________________________________________
>     Interest mailing list
>     Interest at qt-project.org <mailto:Interest at qt-project.org>
>     http://lists.qt-project.org/mailman/listinfo/interest
>
>


-- 
Bo Thorsen, European Engineering Manager, ICS
Integrated Computer Solutions. Delivering World-Class Applications
http://ics.com/services



More information about the Interest mailing list