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@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest