EXC_BAD_ACCESS on NSTableView object value or Set object Value.

Discussion in 'Mac Programming' started by mkristain, Nov 7, 2011.

  1. mkristain, Nov 7, 2011
    Last edited: Nov 7, 2011

    mkristain macrumors regular

    Joined:
    Aug 18, 2011
    #1
    hi please help me to resolve this.

    i am using a NSTableView and a IKImageBrowserView,when i inserting different type of images in IKImageBrowser,i update the its counter in NSTableView,using below method,

    but some times application gives EXC_BAD_ACCESS.

    so please guide me.

    my code is

    Code:
    - (id) tableView:(NSTableView *)pTableViewObj objectValueForTableColumn:(NSTableColumn *)pTableColumn row:(int)pRowIndex
    {
            id record, value;
    			
    	record = [nsDataObject objectAtIndex:pRowIndex];
    			
    			
    	value = [record objectForKey:[pTableColumn identifier]];
    			
    			
    	return value;
    
    }
    
    - (void)tableView:(NSTableView *)pTableViewObj setObjectValue:(id)pObject forTableColumn:(NSTableColumn *)pTableColumn row:(int)pRowIndex
    {
         [nsDataObject replaceObjectAtIndex:pRowIndex withObject:pObject];
    			
    }
    

    what wrong here?

    please help.
     
  2. gnasher729 macrumors P6

    gnasher729

    Joined:
    Nov 25, 2005
    #2
    How long have you been doing this?

    Look at who is calling what at the time of the crash.
    Look at what object is calling the crash.

    Then use your brain. And NSLog statements.

    This is about the most stupid help request that you could post here. You have a Mac, the running application, a running debugger, all the tools you need. We don't.
     
  3. mkristain thread starter macrumors regular

    Joined:
    Aug 18, 2011
    #3
    here its point out in debugger :

    Code:
    #0	0x9581d1ca in ___CFBasicHashFindBucket1
    #1	0x958254cc in CFBasicHashFindBucket
    #2	0x95825393 in CFDictionaryGetValue
    #3	0x00007f17 in -[MyTableController tableView:objectValueForTableColumn:row:] at MyTableController.m:2261
    #4	0x92216417 in -[NSTableView _dataSourceValueForColumn:row:]
    #5	0x921933ea in -[NSTableView preparedCellAtColumn:row:]
    #6	0x921ad8bc in -[NSTableView _drawContentsAtRow:column:withCellFrame:]
    #7	0x921ac92a in -[NSTableView drawRow:clipRect:]
    #8	0x921ac362 in -[NSTableView drawRowIndexes:clipRect:]
    #9	0x921aad3b in -[NSTableView drawRect:]
    #10	0x921a082a in -[NSView _drawRect:clip:]
    
    
     
  4. gnasher729 macrumors P6

    gnasher729

    Joined:
    Nov 25, 2005
    #4
    Great. Now think about what is happening. Who wrote CFDictionaryGetValue? Do you think it contains bugs that crash sometimes, or do you think something is wrong with the data it is given? Which data is it given? Which dictionary, and which key? What happens if you try to display the dictionary or the key? Why the hell don't you store the key into a local variable, and add an NSLog statement that prints its contents, and another NSLog statement that prints the contents of the dictionary?
     
  5. mkristain thread starter macrumors regular

    Joined:
    Aug 18, 2011
    #5
    some times its point out here?

    Code:
    0x920b4c18 in -[NSCell setObjectValue:]
    0x9219347f in -[NSTableView preparedCellAtColumn:row:]
    0x921ad8bc in -[NSTableView _drawContentsAtRow:column:withCellFrame:]
    0x921ac92a in -[NSTableView drawRow:clipRect:]
    0x921ac362 in -[NSTableView drawRowIndexes:clipRect:]
    0x921aad3b in -[NSTableView drawRect:]
    
    
    please guide me to resolve this.

    thanks.
     
  6. gnasher729 macrumors P6

    gnasher729

    Joined:
    Nov 25, 2005
    #6
    So where did you add NSLog statements?
    The bug is not where it crashes; the bug happens a lot earlier.
    NSLog statements put into the right places will help you finding out _where_ things start going wrong. So where have you added NSLog statements so far?

    And did you do anything with the previous advice, which was exactly meant to _guide_ you?

    What about just the first question: Who wrote CFDictionaryGetValue? Can you answer that?
     

Share This Page