Ensure drag finish timer doesnt fire will waiting for remote item data

This commit is contained in:
Kovid Goyal 2026-05-13 10:59:44 +05:30
parent 9c29c612a5
commit c2a7225657
No known key found for this signature in database
GPG key ID: 06BC317B515ACE7C
2 changed files with 7 additions and 1 deletions

View file

@ -4462,7 +4462,11 @@ _glfwPlatformStartDrag(_GLFWwindow* window, const GLFWimage* thumbnail) {@autore
- (bool)is_mimetype:(const char*)q { return strcmp(q, mimeType) == 0; } - (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)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]; if (file_handle) [file_handle release];
file_handle = nil; file_handle = nil;
NSFileManager *fileManager = [NSFileManager defaultManager]; NSFileManager *fileManager = [NSFileManager defaultManager];

View file

@ -1666,6 +1666,7 @@ static int
notify_drag_data_received(Window *w, size_t uri_item_idx, const char *basename, int type) { notify_drag_data_received(Window *w, size_t uri_item_idx, const char *basename, int type) {
char mime_type[128], path[4096]; char mime_type[128], path[4096];
snprintf(mime_type, sizeof(mime_type), "kitty-internal/uri-list-item-%zu", uri_item_idx); 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); 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); 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"); 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; ri = &ds.file_promises[promise_item_idx].ri;
notify_drag_data_received(w, uri_item_idx, "", ri->type);
} else { } else {
if (uri_item_idx >= mi.num_remote_items) abrt(EINVAL, "drag source uri list index out of bounds"); 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; ri = mi.remote_items + uri_item_idx;