Fix a crash on exit on macOS
Calling Python API functions is not allowed in atexit handlers. Fixes #3686
This commit is contained in:
parent
2e7b68bf74
commit
93e9d3cb5f
4 changed files with 14 additions and 4 deletions
|
|
@ -76,6 +76,8 @@ To update |kitty|, :doc:`follow the instructions <binary>`.
|
|||
- Fix a regression that caused using the ``title`` command in session files
|
||||
to stop working (:iss:`3676`)
|
||||
|
||||
- macOS: Fix a rare crash on exit (:iss:`3686`)
|
||||
|
||||
|
||||
0.20.3 [2021-05-06]
|
||||
----------------------
|
||||
|
|
|
|||
|
|
@ -160,9 +160,11 @@ + (GlobalMenuTarget *) shared_instance
|
|||
|
||||
static PyObject*
|
||||
set_notification_activated_callback(PyObject *self UNUSED, PyObject *callback) {
|
||||
if (notification_activated_callback) Py_DECREF(notification_activated_callback);
|
||||
notification_activated_callback = callback;
|
||||
Py_INCREF(callback);
|
||||
Py_CLEAR(notification_activated_callback);
|
||||
if (callback != Py_None)
|
||||
notification_activated_callback = callback;
|
||||
Py_INCREF(callback);
|
||||
}
|
||||
Py_RETURN_NONE;
|
||||
}
|
||||
|
||||
|
|
@ -638,7 +640,6 @@ - (BOOL)openFilesFromPasteboard:(NSPasteboard *)pasteboard type:(int)type {
|
|||
|
||||
if (dockMenu) [dockMenu release];
|
||||
dockMenu = nil;
|
||||
Py_CLEAR(notification_activated_callback);
|
||||
|
||||
#ifndef KITTY_USE_DEPRECATED_MACOS_NOTIFICATION_API
|
||||
drain_pending_notifications(NO);
|
||||
|
|
|
|||
|
|
@ -1182,3 +1182,7 @@ def click_mouse_url(os_window_id: int, tab_id: int, window_id: int) -> None:
|
|||
|
||||
def mouse_selection(os_window_id: int, tab_id: int, window_id: int, code: int, button: int) -> None:
|
||||
pass
|
||||
|
||||
|
||||
def set_notification_activated_callback(cb: Optional[Callable]) -> None:
|
||||
pass
|
||||
|
|
|
|||
|
|
@ -178,6 +178,9 @@ def __call__(self, opts: Options, args: CLIOptions, bad_lines: Sequence[BadLine]
|
|||
finally:
|
||||
set_options(None)
|
||||
free_font_data() # must free font data before glfw/freetype/fontconfig/opengl etc are finalized
|
||||
if is_macos:
|
||||
from kitty.fast_data_types import set_notification_activated_callback
|
||||
set_notification_activated_callback(None)
|
||||
|
||||
|
||||
run_app = AppRunner()
|
||||
|
|
|
|||
Loading…
Reference in a new issue