Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
It turns out that QSqlDatabase connections are totally not thread-safe. A connection must only be used in one thread, from the point where it's opened and added right through until where it's closed and removed. Our old code depended solely on the ~MythContext dtor to close all the database connections, so any connection not opened in the UI thread confused the Qt code, and mysql's API waited for the wrong threads at shutdown. This caused a 5s delay and an ugly message like: Error in my_thread_global_end(): 1 threads didn't exit To fix this, the database logging thread now has its own database connection, and threads that open connections are now explicitly closing them. Additionally, the WriteDelayedSettings() code is forced to only run in the UI thread. Ideally, we need a centralized DB thread that handles all of the connections, but that's a fairly large change, and can wait a bit longer
- Loading branch information
Showing
8 changed files
with
152 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.