From c2a7225657f208000f1a261de1b6c6e7543b5fcb Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Wed, 13 May 2026 10:59:44 +0530 Subject: [PATCH] Ensure drag finish timer doesnt fire will waiting for remote item data --- glfw/cocoa_window.m | 6 +++++- kitty/dnd.c | 2 ++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/glfw/cocoa_window.m b/glfw/cocoa_window.m index 9e59ab861..fce4b72fd 100644 --- a/glfw/cocoa_window.m +++ b/glfw/cocoa_window.m @@ -4462,7 +4462,11 @@ _glfwPlatformStartDrag(_GLFWwindow* window, const GLFWimage* thumbnail) {@autore - (bool)is_mimetype:(const char*)q { return strcmp(q, mimeType) == 0; } - (void)promised_data_ready:(const char*)path sz:(size_t)sz type:(int)type { - (void)sz; + if (drag_finish_timer) { + [drag_finish_timer invalidate]; + drag_finish_timer = nil; + } + if (path == NULL) return; // progress update if (file_handle) [file_handle release]; file_handle = nil; NSFileManager *fileManager = [NSFileManager defaultManager]; diff --git a/kitty/dnd.c b/kitty/dnd.c index 15d2536f4..28d237228 100644 --- a/kitty/dnd.c +++ b/kitty/dnd.c @@ -1666,6 +1666,7 @@ static int notify_drag_data_received(Window *w, size_t uri_item_idx, const char *basename, int type) { char mime_type[128], path[4096]; snprintf(mime_type, sizeof(mime_type), "kitty-internal/uri-list-item-%zu", uri_item_idx); + if (!basename || !basename[0]) notify_drag_data_ready(global_state.drag_source.from_os_window, mime_type, NULL, 0, type); int sz = snprintf(path, sizeof(path), "%s/%zu/%s", ds.base_dir_for_remote_items, uri_item_idx, basename); return notify_drag_data_ready(global_state.drag_source.from_os_window, mime_type, path, sz, type); } @@ -2251,6 +2252,7 @@ drag_remote_file_data( } if (promise_item_idx == ds.file_promises_count + 1) abrt(EINVAL, "drag source file promise uri list index out of bounds"); ri = &ds.file_promises[promise_item_idx].ri; + notify_drag_data_received(w, uri_item_idx, "", ri->type); } else { if (uri_item_idx >= mi.num_remote_items) abrt(EINVAL, "drag source uri list index out of bounds"); ri = mi.remote_items + uri_item_idx;