[Interest] Annoying Bug - Qt 4.8.1 bug?
Etienne Sandré-Chardonnal
etienne.sandre at m4x.org
Thu Jan 23 12:25:02 CET 2014
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>
> 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
> http://lists.qt-project.org/mailman/listinfo/interest
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20140123/6103a117/attachment.html>
More information about the Interest
mailing list