“EXC_BAD_ACCESS” object is not nil but not accessible
“EXC_BAD_ACCESS” object is not nil but not accessible
- Subject: “EXC_BAD_ACCESS” object is not nil but not accessible
- From: Marco Frisan <email@hidden>
- Date: Sat, 15 Jan 2011 12:55:27 +0100
- Resent-date: Sun, 16 Jan 2011 18:38:22 +0100
- Resent-from: Marco Frisan <email@hidden>
- Resent-message-id: <email@hidden>
- Resent-to: email@hidden
Hello all,
and thanks in advance for any help.
I am making a test application to play with files informations. The Xcode project file can be downloaded here VolumeList.zip (http://endercg.altervista.org/files/VolumeList.zip)
The application gets all the removable media volumes paths currently mounted on the system, using [[NSWorkspace sharedWorkspace] mountedRemovableMedia]. Then it creates and fill an object of class VLDiskItemRecord, for each path found, passing path and the display name of the item.
The list of items is displayed in a table view, showing display name (first column) and path (secondo column).
When I click on one item in the list its details (item attributes obtained with attributesOfItemAtPath: of the NSFileManager class) should be displayed in a details table view that shows the attribute name (first column) and the attribute value (second column).
The details table data source, uses 2 NSArray objects to cache the keys and the values of the attributes dictionary.
Though they seem to be not relevant since the application blocks for a “EXC_BAD_ACCESS” signal a little before to initialize them, in the body of the numberOfRowsInTableView: of the details table data source (VLVolumeDetailsViewController), when I try to get the attributes dictionary with a call to the property _record.attributes.
If I roll over the _record variable, while application i still blocked at that point and with debugger active, and I expand hits content, I get:
Cannot access memory at address 0x7043c748
Though the object pointed by _record has address 0x103141230, hand its members have addresses: 0x10313f760, 0x10313f5f0 and 0x10313f780 (the last one is the attributes dictionary).
I don't understand why _record.attributes causes a “EXC_BAD_ACCESS” signal.
This is the output:
2011-01-15 12:19:28.506 VolumesList[315:a0f] -[VLVolumeDetailsViewController init]
2011-01-15 12:19:28.508 VolumesList[315:a0f] -[VLVolumesListViewController init]
2011-01-15 12:19:28.521 VolumesList[315:a0f] -[VLVolumesListViewController numberOfRowsInTableView:]
2011-01-15 12:19:28.584 VolumesList[315:a0f] -[VLVolumeDetailsViewController numberOfRowsInTableView:]
2011-01-15 12:19:28.606 VolumesList[315:a0f] -[VLVolumesListViewController load]
2011-01-15 12:19:28.606 VolumesList[315:a0f] media = (
"/Volumes/18042004"
)
2011-01-15 12:19:28.607 VolumesList[315:a0f] -[VLDiskItemRecord initWithName:mountPoint:]
2011-01-15 12:19:28.607 VolumesList[315:a0f] -[VLDiskItemRecord initAttributes]
2011-01-15 12:19:28.608 VolumesList[315:a0f] Record: <VLDiskItemRecord: 0x103141230>; name: 18042004; path: /Volumes/18042004
2011-01-15 12:19:28.608 VolumesList[315:a0f] _records is nil, initialize it! ...
2011-01-15 12:19:28.608 VolumesList[315:a0f] _records initialized with object (
)
2011-01-15 12:19:28.608 VolumesList[315:a0f] _records count: 1
2011-01-15 12:19:28.609 VolumesList[315:a0f] -[VLVolumesListViewController numberOfRowsInTableView:]
2011-01-15 12:19:28.610 VolumesList[315:a0f] -[VLVolumesListViewController tableView:objectValueForTableColumn:row:]
2011-01-15 12:19:28.610 VolumesList[315:a0f] -[VLVolumesListViewController tableView:objectValueForTableColumn:row:]
2011-01-15 12:19:28.613 VolumesList[315:a0f] -[VLVolumesListViewController tableView:objectValueForTableColumn:row:]
2011-01-15 12:19:28.614 VolumesList[315:a0f] -[VLVolumesListViewController tableView:objectValueForTableColumn:row:]
2011-01-15 12:19:32.931 VolumesList[315:a0f] -[VLVolumesListViewController tableView:objectValueForTableColumn:row:]
2011-01-15 12:19:32.932 VolumesList[315:a0f] -[VLVolumesListViewController tableView:objectValueForTableColumn:row:]
2011-01-15 12:19:34.498 VolumesList[315:a0f] -[VLVolumesListViewController tableView:objectValueForTableColumn:row:]
2011-01-15 12:19:34.499 VolumesList[315:a0f] -[VLVolumesListViewController tableView:objectValueForTableColumn:row:]
2011-01-15 12:19:34.501 VolumesList[315:a0f] -[VLVolumesListViewController tableView:objectValueForTableColumn:row:]
2011-01-15 12:19:34.502 VolumesList[315:a0f] -[VLVolumesListViewController tableView:objectValueForTableColumn:row:]
2011-01-15 12:19:34.562 VolumesList[315:a0f] -[VLVolumesListViewController tableViewSelectionDidChange:]
(gdb) continue
Current language: auto; currently objective-c
2011-01-15 12:19:39.401 VolumesList[315:a0f] -[VLVolumeDetailsViewController setRecord:]
2011-01-15 12:19:39.401 VolumesList[315:a0f] -[VLVolumeDetailsViewController numberOfRowsInTableView:]
Program received signal: “EXC_BAD_ACCESS”.
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden