Closed bibimbop closed 10 years ago
On Mac, I get the "Save the file?" dialog as soon as I hit Quit (do you?). The status message "Counting words and characters" is visible and the progress bar about 25%.
I click No, and the window goes away, but in fact there's a Python process still running and using CPU. If I wait long enough (30-60 seconds) it ends, sometimes displaying "QThread: Destroyed while thread is still running" on the console.
Using my excellent Wing IDE I can pause the running program after the window has vanished, it is in the edit census code, called from rebuildMetadata, called from the Word (or Char) refresh routine, which is called from app.exec_().
So it appears that Qt cleverly runs the Refresh button-press signal on one thread, and the File>Quit menu event on a separate thread. File>Quit is linked to self.close() which is inherited from QMainWindow. That issues the closeEvent signal, calling closeEvent() which saves the settings; after which presumably close() destroys the main window object and everything parented by it, and exits.
Meanwhile on the Refresh button-clicked thread the census keeps going -- the editor object was created independently and wouldn't automatically be destroyed with the main window. When it finishes, it returns to the Word (or Char) panel, which returns to whatever part of Qt created that signal. Now there's nothing running and no UI widgets. I don't know what is happening then until it quits.
I'm not sure what to do, if anything. I suppose I could write a main window close() method that could check -- what? If there is a progress bar running? And do what...?
Open a document, go to the Chars tab and click refresh. While it is counting, close PPQT. ==> the application never finishes.
Possibly a linux only problem.