Fix #133713: Crash when drag and dropping bitmap images on macOS
Drag and dropping bitmap images (as in drag and dropping directly from another software such as a web browser, not from an image file in Finder) inside the Blender window on macOS would segfault due to the dropped image being [autorelease]d even though its data was meant to outlive the function scope. Fixed by removing the superflous autorelease and adding a comment note. The only caller of this function (GHOST_SystemCocoa::handleDraggingEvent) already properly [release]s the image in question. Note that currently, non-file/bitmap image drag and drop is not implemented on the WM side, and as such this feature/GHOST event does not do anything practical. Pull Request: https://projects.blender.org/blender/blender/pulls/135076
This commit is contained in:
@@ -270,14 +270,12 @@
|
||||
|
||||
switch (m_draggedObjectType) {
|
||||
case GHOST_kDragnDropTypeBitmap: {
|
||||
if ([NSImage canInitWithPasteboard:draggingPBoard]) {
|
||||
NSImage *droppedImg = [[[NSImage alloc] initWithPasteboard:draggingPBoard] autorelease];
|
||||
data = droppedImg; // [draggingPBoard dataForType:NSPasteboardTypeTIFF];
|
||||
}
|
||||
else {
|
||||
if (![NSImage canInitWithPasteboard:draggingPBoard]) {
|
||||
return NO;
|
||||
}
|
||||
|
||||
/* Caller must [release] the returned data in this case. */
|
||||
NSImage *droppedImg = [[NSImage alloc] initWithPasteboard:draggingPBoard];
|
||||
data = droppedImg;
|
||||
break;
|
||||
}
|
||||
case GHOST_kDragnDropTypeFilenames:
|
||||
|
||||
Reference in New Issue
Block a user