fontlabapp.qt.safe
safe
Keep PythonQt widget pointers alive during native list conversion.
What it does:
qt_list converts a native QList of object pointers with cyclic GC off.
main_window finds FontLab's main window with the same safety.
Why:
PythonQt wraps each pointer as a Python object. That allocation can start
the cyclic collector, which can free a Python-owned widget that is still in
the list. The next pointer then dangles and FontLab segfaults in
PythonQtPrivate::wrapPtr (measured on FontLab 9.0.9780).
Thread rule:
GUI thread only, and the guard enforces it. gc.disable() is process
wide. A call from another thread could re-enable collection while the GUI
thread is still converting. The guard does not stop an explicit
gc.collect() or reference-count destruction.
Missing window:
main_window raises MainWindowNotFound when FontLab has no main
window. It is a RuntimeError with the old text, so older callers that
catch RuntimeError or match "main window not found" keep working. New
callers catch the class: the off-thread refusal stays a plain
RuntimeError and is therefore never taken for a missing host.
Cold import: stdlib only. Callers pass fontlab and qt in.
Classes
Complete member index
Every captured member retains its own identity. Identical captured declaration text is linked once; this does not establish native inheritance or interchangeable objects.
| Member | Kind | Signature | Summary |
|---|---|---|---|
MAIN_WINDOW_CLASS |
attribute | ||
main_window |
function | (fontlab: Any, qt: Any) -> Any |
Return FontLab's main window; GUI thread only. |
qt_list |
function | (call: Callable[..., Any], *args: Any) -> list[Any] |
Convert a native widget list with cyclic GC off (GUI thread only). |