diff -r da05df77652e -r 3ca3acefc66a application/window.c --- a/application/window.c Mon Oct 21 13:22:45 2024 +0200 +++ b/application/window.c Mon Oct 21 15:45:12 2024 +0200 @@ -109,7 +109,13 @@ - +static void resourceviewer_close(UiEvent *event, void *data) { + DavResourceViewer *doc = data; + doc->window_closed = TRUE; + if(doc->loaded) { + dav_resourceviewer_destroy(doc); + } +} void resourceviewer_new(DavBrowser *browser, const char *path, DavResourceViewType type) { const char *name = util_resource_name(path); @@ -117,6 +123,7 @@ DavResourceViewer *doc = dav_resourceviewer_create(browser->sn, path, type); ui_attach_document(win->ctx, doc); + ui_context_closefunc(win->ctx, resourceviewer_close, doc); ui_tabview(win, .tabview = UI_TABVIEW_INVISIBLE, .varname = "tabview") { /* loading / message tab */