destroy player on exit
authorOlaf Wintermann <olaf.wintermann@gmail.com>
Fri, 14 Jan 2022 10:45:42 +0000 (11:45 +0100)
committerOlaf Wintermann <olaf.wintermann@gmail.com>
Fri, 14 Jan 2022 10:45:42 +0000 (11:45 +0100)
application/window.c
application/window.h

index e5fc815..dd8700c 100644 (file)
@@ -38,6 +38,7 @@ static void FileOpenCB(Widget w, void *udata, void *cdata);
 static void ViewFullscreenCB(Widget w, void *udata, void *cdata);
 
 static void window_close_handler(Widget window, void *udata, void *cdata) {
+    WindowClosePlayer(main_window);
     ApplicationExit();
 }
 
@@ -364,3 +365,10 @@ void WindowAdjustAspectRatio(MainWindow *win) {
     hints.max_aspect.y = new_height;
     XSetWMNormalHints(XtDisplay(win->window), XtWindow(win->window), &hints);
 }
+
+void WindowClosePlayer(MainWindow *win) {
+    if(win->player) {
+        PlayerDestroy(win->player);
+    }
+    win->player = NULL;
+}
index d3e8623..402b6ed 100644 (file)
@@ -68,6 +68,8 @@ void WindowMenubarSetVisible(MainWindow *win, bool visible);
 
 void WindowAdjustAspectRatio(MainWindow *win);
 
+void WindowClosePlayer(MainWindow *win);
+
 #ifdef __cplusplus
 }
 #endif