SIGBUS errors when dragging from the Finder to an NSTableView
SIGBUS errors when dragging from the Finder to an NSTableView
- Subject: SIGBUS errors when dragging from the Finder to an NSTableView
- From: Michael James <email@hidden>
- Date: Thu, 15 Aug 2002 15:47:07 -0400
I am trying to allow the user to drop a folder of .mp3 files onto the
table in my application. When the user drops this folder onto the
table, I will import the files that are in the folder. My application
can currently import data by choosing Import from the File menu, but it
would be more natural to allow the user to drag files onto the table. I
have registered my table to accept files being dropped in it
(NSFilenamesPboardType) and implemented the
tableView:validateDrop:proposedRow:proposedDropOperation: and
tableView:acceptDrop:row:dropOperation: methods in the table's data
source class. In the first method, I look for an NSFilenamesPboardType
and if one exists, I return NSDragOperationGeneric, otherwise I return
NSDragOperationNone. In the second method, I get the property list
(which is an array of strings) from the drag pasteboard, then I call my
import method, then I return YES.
The problem I am having occurs when I run the application. If I import
data by choosing Import from the File menu, everything works as it did
before, but if I drag the data onto the table it imports the data, I see
the data in the table and then the application instantly crashes with a
SIGBUS (signal 10) error. The only way I can keep the app from crashing
is if I comment out the portion of my importing code
that uses QuickTime to get the length of the .mp3 files.
I thought that maybe my importing code was incorrect, but how can that
be when this same code is being used when I import via the File menu,
and that works with no problems. I was initially using the NSMovie
class to get to the QuickTime Movie structure, then I rewrote it using
Carbon and the QuickTime API, but that didn't change anything.
When I ran the program through the debugger, the SIGBUS happens after it
leaves my code. The stack trace is as follows:
#0 -[myTableDataSource tableView:acceptDrop:row:dropOperation:] ()
#1 0x70c38698 in -[NSTableView performDragOperation:] ()
#2 0x70db54e8 in NSCopyBitsFromGraphicsContext ()
#3 0x73d73f64 in CoreAppearanceCountFontFallbacks ()
#4 0x73d7e890 in GetPasteboardFlavorType ()
#5 0x701a4880 in CFMessagePortSendRequest ()
#6 0x7018f39c in CFStringEncodingByteLengthForCharacters ()
#7 0x7017c1cc in CFRunLoopRunInMode ()
#8 0x701b70ec in CFRunLoopRunSpecific ()
#9 0x7017b8cc in CFRunLoopRunInMode ()
#10 0x7312d904 in InvokeThemeButtonDrawUPP ()
#11 0x731407a4 in GetNextWindow ()
#12 0x731715fc in BlockUntilNextEventMatchingListInMode ()
#13 0x70bd70b8 in _DPSNextEvent ()
#14 0x70bfe5d8 in -[NSApplication
nextEventMatchingMask:untilDate:inMode:dequeue:] ()
#15 0x70c23468 in -[NSApplication run] ()
#16 0x70c91ed0 in NSApplicationMain ()
#17 0x00003dc4 in main ()
#18 0x00003ce8 in _start ()
#19 0x00003b18 in start ()
But, when it crashes, the stack trace looks like this:
#0 0x735f92a8 in AEGetDescDataSize ()
#1 0x735fc418 in AESizeOfFlattenedDesc ()
#2 0x73d75e60 in __initialize_Cplusplus ()
#3 0x73d7e92c in GetPasteboardFlavorType ()
#4 0x701a4880 in CFMessagePortSendRequest ()
#5 0x7018f39c in CFStringEncodingByteLengthForCharacters ()
#6 0x7017c1cc in CFRunLoopRunInMode ()
#7 0x701b70ec in CFRunLoopRunSpecific ()
#8 0x7017b8cc in CFRunLoopRunInMode ()
#9 0x7083e750 in -[NSRunLoop runMode:beforeDate:] ()
#10 0x70896398 in -[NSRunLoop runUntilDate:] ()
#11 0x70db5af0 in NSCopyBitsFromGraphicsContext ()
#12 0x73d7c2d4 in CoreScrapSetPromiseKeeper ()
#13 0x73d7e814 in GetPasteboardFlavorType ()
#14 0x701a4880 in CFMessagePortSendRequest ()
#15 0x7018f39c in CFStringEncodingByteLengthForCharacters ()
#16 0x7017c1cc in CFRunLoopRunInMode ()
#17 0x701b70ec in CFRunLoopRunSpecific ()
#18 0x7017b8cc in CFRunLoopRunInMode ()
#19 0x7312d904 in InvokeThemeButtonDrawUPP ()
#20 0x731407a4 in GetNextWindow ()
#21 0x731715fc in BlockUntilNextEventMatchingListInMode ()
#22 0x70bd70b8 in _DPSNextEvent ()
#23 0x70bfe5d8 in -[NSApplication
nextEventMatchingMask:untilDate:inMode:dequeue:] ()
#24 0x70c23468 in -[NSApplication run] ()
#25 0x70c91ed0 in NSApplicationMain ()
#26 0x00003dc4 in main ()
#27 0x00003ce8 in _start ()
#28 0x00003b18 in start ()
I understand that you normally get a SIGBUS as a result of trying to
access memory in a way that you don't have permission to, such as
writing to a read-only memory location. But I don't have anything like
that in my code. I don't believe I have any retain/release/autorelease
discrepancies. I can provide code snippets if needed. Any help on
this, would be tremendously appreciated. Thanks.
- Michael James
email@hidden
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.