Forgot to destroy glfw window when closing OSWindow
Also fix double decref of OSWindow->window_title
This commit is contained in:
parent
407431adc8
commit
c145dfc832
@ -487,6 +487,7 @@ static inline bool
|
||||
update_window_title(Window *w, OSWindow *os_window) {
|
||||
if (w->title && w->title != os_window->window_title) {
|
||||
os_window->window_title = w->title;
|
||||
Py_INCREF(os_window->window_title);
|
||||
set_os_window_title(os_window, PyUnicode_AsUTF8(w->title));
|
||||
#ifdef __APPLE__
|
||||
if (os_window == global_state.focused_os_window) cocoa_update_title(w->title);
|
||||
@ -661,6 +662,7 @@ main_loop(ChildMonitor *self) {
|
||||
for (size_t w = global_state.num_os_windows; w > 0; w--) {
|
||||
OSWindow *os_window = global_state.os_windows + w - 1;
|
||||
if (should_os_window_close(os_window)) {
|
||||
destroy_os_window(os_window);
|
||||
call_boss(on_os_window_closed, "Kii", os_window->id, os_window->viewport_width, os_window->viewport_width);
|
||||
for (size_t t=0; t < os_window->num_tabs; t++) {
|
||||
Tab *tab = os_window->tabs + t;
|
||||
|
||||
@ -275,6 +275,12 @@ create_os_window(PyObject UNUSED *self, PyObject *args) {
|
||||
return PyLong_FromUnsignedLongLong(w->id);
|
||||
}
|
||||
|
||||
void
|
||||
destroy_os_window(OSWindow *w) {
|
||||
if (w->handle) glfwDestroyWindow(w->handle);
|
||||
w->handle = NULL;
|
||||
}
|
||||
|
||||
// Global functions {{{
|
||||
static void
|
||||
error_callback(int error, const char* description) {
|
||||
|
||||
@ -164,7 +164,7 @@ remove_tab(id_type os_window_id, id_type id) {
|
||||
}
|
||||
|
||||
static inline void
|
||||
destroy_os_window(OSWindow *w) {
|
||||
destroy_os_window_item(OSWindow *w) {
|
||||
for (size_t t = w->num_tabs; t > 0; t--) {
|
||||
Tab *tab = w->tabs + t - 1;
|
||||
remove_tab_inner(w, tab->id);
|
||||
@ -183,7 +183,7 @@ remove_os_window(id_type os_window_id) {
|
||||
END_WITH_OS_WINDOW
|
||||
if (found) {
|
||||
WITH_OS_WINDOW_REFS
|
||||
REMOVER(global_state.os_windows, os_window_id, global_state.num_os_windows, OSWindow, destroy_os_window, global_state.capacity);
|
||||
REMOVER(global_state.os_windows, os_window_id, global_state.num_os_windows, OSWindow, destroy_os_window_item, global_state.capacity);
|
||||
END_WITH_OS_WINDOW_REFS
|
||||
}
|
||||
return found;
|
||||
|
||||
@ -143,6 +143,7 @@ void event_loop_wait(double timeout);
|
||||
void swap_window_buffers(OSWindow *w);
|
||||
void make_window_context_current(OSWindow *w);
|
||||
void hide_mouse(OSWindow *w);
|
||||
void destroy_os_window(OSWindow *w);
|
||||
void set_os_window_title(OSWindow *w, const char *title);
|
||||
OSWindow* os_window_for_kitty_window(id_type);
|
||||
OSWindow* add_os_window();
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user