Skip to content

Dragging and dropping a file doesn't work in macOS Mojave #1058

@Luflosi

Description

@Luflosi

When trying to drag and drop a file, the following error is printed:

2018-10-10 23:18:59.888 kitty[24205:1276159] -[__NSCFString count]: unrecognized selector sent to instance 0x7fac47c383c0
2018-10-10 23:18:59.889 kitty[24205:1276159] *** Canceling drag because exception 'NSInvalidArgumentException' (reason '-[__NSCFString count]: unrecognized selector sent to instance 0x7fac47c383c0') was raised during a dragging session

No file path appears in the shell.
The error seems to come from glfw/cocoa_window.m, line 930 (const NSUInteger count = [files count];). If I replace const NSUInteger count = [files count]; by const NSUInteger count = 1;, an error will occur a couple lines below (NSEnumerator* e = [files objectEnumerator];). The files variable seems to contain something unexpected. Adding files = [NSArray arrayWithObjects:@"test", nil]; below NSArray* files = [pasteboard propertyListForType:NSPasteboardTypeFileURL]; in line 925 to overwrite the contents of the array with something known will paste test in the shell when dropping a file, as expected. NSLog(@"%@", files); outputs 2018-10-10 23:14:23.518 kitty[23756:1273375] file:///.file/id=6571367.8608983890/ in an otherwise unmodified kitty.
Sadly I don't know Objective-C enough yet to debug this issue further.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions