mirror of
https://github.com/kovidgoyal/kitty
synced 2026-07-16 05:24:20 +02:00
Improve at exit cleanup functions
Now they are run in a defined order not based on the order of initialization
This commit is contained in:
@@ -12,6 +12,7 @@
|
||||
#undef _DARWIN_C_SOURCE
|
||||
#endif
|
||||
#include "data-types.h"
|
||||
#include "cleanup.h"
|
||||
#include "safe-wrappers.h"
|
||||
#include "control-codes.h"
|
||||
#include "wcwidth-std.h"
|
||||
@@ -226,6 +227,10 @@ PyInit_fast_data_types(void) {
|
||||
|
||||
m = PyModule_Create(&module);
|
||||
if (m == NULL) return NULL;
|
||||
if (Py_AtExit(run_at_exit_cleanup_functions) != 0) {
|
||||
PyErr_SetString(PyExc_RuntimeError, "Failed to register the atexit cleanup handler");
|
||||
return NULL;
|
||||
}
|
||||
init_monotonic();
|
||||
|
||||
if (!init_logging(m)) return NULL;
|
||||
@@ -237,6 +242,7 @@ PyInit_fast_data_types(void) {
|
||||
if (!init_child_monitor(m)) return NULL;
|
||||
if (!init_ColorProfile(m)) return NULL;
|
||||
if (!init_Screen(m)) return NULL;
|
||||
if (!init_glfw(m)) return NULL;
|
||||
if (!init_child(m)) return NULL;
|
||||
if (!init_state(m)) return NULL;
|
||||
if (!init_keys(m)) return NULL;
|
||||
@@ -256,7 +262,6 @@ PyInit_fast_data_types(void) {
|
||||
if (!init_freetype_render_ui_text(m)) return NULL;
|
||||
#endif
|
||||
if (!init_fonts(m)) return NULL;
|
||||
if (!init_glfw(m)) return NULL;
|
||||
|
||||
PyModule_AddIntConstant(m, "BOLD", BOLD_SHIFT);
|
||||
PyModule_AddIntConstant(m, "ITALIC", ITALIC_SHIFT);
|
||||
|
||||
Reference in New Issue
Block a user