-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #267 from altendky/warning_for_early_quit
- Loading branch information
Showing
8 changed files
with
99 additions
and
2 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,6 +11,7 @@ | |
|
||
getting_started.rst | ||
core.rst | ||
lifetimes.rst | ||
testing.rst | ||
dialogs.rst | ||
exceptions.rst | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
.. _lifetime: | ||
|
||
Lifetimes | ||
========= | ||
|
||
In default usage, QTrio will automatically manage the lifetime of the Qt application. | ||
For the Trio guest mode to function, including during cleanup, the Qt application must | ||
be active and processing events. If a program changes this process it can cause parts | ||
of the system to not work correctly. Trio's guest mode can't call any of your | ||
code after the Qt application has quit. This includes cleanup code such as in | ||
``finally`` blocks. | ||
|
||
The most direct way to cause this is by calling :meth:`QtCore.QCoreApplication.quit`. | ||
Enabling :meth:`QtGui.QGuiApplication.setQuitOnLastWindowClosed` and closing all | ||
windows will cause early event loop termination as well. If manual termination of the | ||
application is truly needed this can be enabled by setting | ||
:attr:`qtrio.Runner.quit_application` to :data:`False`. | ||
|
||
QTrio makes an effort to emit a :class:`qtrio.ApplicationQuitWarning`. The message | ||
includes a link to this page as a reminder. | ||
|
||
.. code:: | ||
.../qtrio/_core.py:751: ApplicationQuitWarning: The Qt application quit early. See https://qtrio.readthedocs.io/en/stable/lifetimes.html | ||
In some cases Trio will emit a warning. | ||
|
||
.. code:: | ||
.../trio/_core/_run.py:2221: RuntimeWarning: Trio guest run got abandoned without properly finishing... weird stuff might happen |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Emit :class:`qtrio.ApplicationQuitWarning` when the Qt application quits but QTrio is expecting to manage :ref:`the application lifetime <lifetime>`. |
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