spacr.qt.crash_recovery¶
Detect repeated launch crashes and start the next launch without the backdrop.
The crash log records Fatal Python error: Segmentation fault and Aborted
with <no Python frame> on the crashing thread – the fault is in native
code, in Qt’s render thread or the GL driver, where no Python stack exists to
report and no except can run. The animated backdrop and its optional GL
canvas are the only things spaCR asks a driver to do at startup.
In that case the application does not open, so the setting that turns the
backdrop off cannot be reached. safespacr starts spaCR without the backdrop
on request; this module does the same automatically.
A marker file is written when a launch begins and removed on a clean shutdown.
Finding it at launch means the previous run ended without a clean shutdown.
After two such exits in a row (CRASHES_BEFORE_DROPPING_THE_BACKDROP), the
next start is made without the backdrop.
Functions¶
|
Record that this run ended properly, clearing the count. |
|
Record that a launch started, and count how many died before it. |
Whether this launch should skip the backdrop and any GL. |
|
Turn off, for this process only, everything that asks a driver to draw. |
Module Contents¶
- spacr.qt.crash_recovery.note_a_clean_shutdown() None[source]¶
Record that this run ended properly, clearing the count.
The count is reset to zero rather than decremented: it counts consecutive unclean exits, and a cumulative total would eventually disable the backdrop on a machine where it works. Every instance and project lock this window holds is released first.
- spacr.qt.crash_recovery.note_that_a_launch_began() int[source]¶
Record that a launch started, and count how many died before it.
- Returns:
the number of consecutive unclean exits, this launch’s predecessor included.
Call once, early, before the backdrop is built. It also takes the per-instance lock: a marker left by a window that is still running is not a crash, so a second window neither counts it nor overwrites it.
- spacr.qt.crash_recovery.should_start_without_the_backdrop(unclean: int | None = None) bool[source]¶
Whether this launch should skip the backdrop and any GL.
- Parameters:
unclean – the count from
note_that_a_launch_began(); read from disk when omitted.- Returns:
Truewhen spaCR has died repeatedly without shutting down.
- spacr.qt.crash_recovery.take_the_backdrop_out_of_this_launch() None[source]¶
Turn off, for this process only, everything that asks a driver to draw.
Only the
SPACR_NO_GLandSPACR_NO_BACKDROPenvironment variables of this process are set; no preference is saved. The next clean run clears the count and the backdrop is shown again.