RackV2 breaks drag and drop file functionality

When attempting to drag and drop a file from the OS filesystem (Finder on MacOS) into VCV Rack v2, I get the following error:

2021-10-10 18:11:10.787 Rack[84932:762275] -[__NSCFString count]: unrecognized selector sent to instance 0x7fdec1e9dbf0
2021-10-10 18:11:10.787 Rack[84932:762275] *** Canceling drag because exception 'NSInvalidArgumentException' (reason '-[__NSCFString count]: unrecognized selector sent to instance 0x7fdec1e9dbf0') was raised during a dragging session

This is module independent and is reproducible on MacOS.

1 Like

I came across this problem just this evening when trying to drag a wav file into a Nysthi sampler in v2 (on Mac Catalina)

Just some added info: Issue does NOT occur on Windows, there drag and drop of external files still works fine in v2.

on my MAC (an M1) the

dropCallback

is never called
(the one set with glfwSetDropCallback )

because it’s failing before in the
performDragOperation

in cocoa_window.m for GLFW

if I use performDragOperation from GLFW 3.3.4, it works…

{
    const NSRect contentRect = [window->ns.view frame];
    // NOTE: The returned location uses base 0,1 not 0,0
    const NSPoint pos = [sender draggingLocation];
    _glfwInputCursorPos(window, pos.x, contentRect.size.height - pos.y);

    NSPasteboard* pasteboard = [sender draggingPasteboard];
    NSDictionary* options = @{NSPasteboardURLReadingFileURLsOnlyKey:@YES};
    NSArray* urls = [pasteboard readObjectsForClasses:@[[NSURL class]]
                                              options:options];
    const NSUInteger count = [urls count];
    if (count)
    {
        char** paths = calloc(count, sizeof(char*));

        for (NSUInteger i = 0;  i < count;  i++)
            paths[i] = _glfw_strdup([urls[i] fileSystemRepresentation]);

        _glfwInputDrop(window, (int) count, (const char**) paths);

        for (NSUInteger i = 0;  i < count;  i++)
            free(paths[i]);
        free(paths);
    }

    return YES;
}
2 Likes

@Vortico :point_up:

2 Likes