Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6646611
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T00:26:15+00:00 2026-05-26T00:26:15+00:00

I’ve been staring at this code for a while now, but can’t figure out

  • 0

I’ve been staring at this code for a while now, but can’t figure out what in the world is wrong. I have a class called SortFilteringController, which manages the different filtering that I have in the system (internal filter, public filter, sort options, etc). Each of these is stored in an array. So I have a convience method, which basically takes any of these arrays, and resets them with some new data.

For example, the setInternalFilter, just calls it.

- (void) setInternalFilterTerms : (NSArray*) filterTerms {

    [self resetArray: &_internalFilters withNewData:filterTerms];
}

The definition of resetArray, is just to dump the existing one (release it), and copy the new data across.

- (void) resetArray: (NSMutableArray**) oldArray withNewData : (NSArray*) newData {

    if (*oldArray != nil) {
        [*oldArray release];
    }


    NSMutableArray* newArray = [[NSMutableArray alloc] initWithArray:newData copyItems:YES];
    *oldArray = [newArray retain];
    [newArray release];    

}

But my problem is I get a crash in the reset method. Not in the simulator, only on the device.

Thread 0 Crashed:
0   libsystem_kernel.dylib          0x331a3a1c __pthread_kill + 8
1   libsystem_c.dylib               0x3404c3b4 pthread_kill + 52
2   libsystem_c.dylib               0x34044bf8 abort + 72
3   libstdc++.6.dylib               0x30e4fa64 __gnu_cxx::__verbose_terminate_handler() + 376
4   libobjc.A.dylib                 0x30fda06c _objc_terminate + 104
5   libstdc++.6.dylib               0x30e4de36 __cxxabiv1::__terminate(void (*)()) + 46
6   libstdc++.6.dylib               0x30e4de8a std::terminate() + 10
7   libstdc++.6.dylib               0x30e4df5a __cxa_throw + 78
8   libobjc.A.dylib                 0x30fd8c84 objc_exception_throw + 64
9   CoreFoundation                  0x33e5f1b8 -[NSObject(NSObject) doesNotRecognizeSelector:] + 96
10  CoreFoundation                  0x33e5e642 ___forwarding___ + 502
11  CoreFoundation                  0x33dd5178 _CF_forwarding_prep_0 + 40
12  CoreFoundation                  0x33dcb156 -[NSArray initWithArray:range:copyItems:] + 366
13  CoreFoundation                  0x33dcafce -[NSArray initWithArray:copyItems:] + 54
14  Wine DB 1.1                     0x001b6a2a -[SortFilterController resetArray:withNewData:] (SortFilterController.m:1310)
15  Wine DB 1.1                     0x001b4188 -[SortFilterController setInternalFilterTerms:] (SortFilterController.m:733)

I am running xcode 4.2 with iOS 5.0 GM seed. My device is still running 4.1.3. But that shouldn’t make a difference right? And the error is “doesNotRecognizeSelector”. How strange is that.

Thanks.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T00:26:16+00:00Added an answer on May 26, 2026 at 12:26 am

    Check to see if oldArray == newData. You’ll notice that the default idiom for a set operation in Objective-C is this:

    -(void) setFoo:(NSThing *)newThing
    {
        [newThing retain];
        [thing release];
        thing = newThing;
    }
    

    If newThing == thing, and you delete the current thing, then you may well cause it to call its destructor. So you always do the retain first.

    So it’s possible your releasing the very objects you want to copy. And, using the latest-and-greatest garbage collectors, the device may be cleaning up faster than the simulator. The bugs is there on both platforms, but the indeterminate nature of the memory manager can make you think it’s transient.

    If nothing else, review your code to make sure you’re not releasing objects you might need to be using later in the function. Just because the variable names are different, it doesn’t mean they aren’t the same object.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a jquery bug and I've been looking for hours now, I can't
this is what i have right now Drawing an RSS feed into the php,
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I have a French site that I want to parse, but am running into
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
Does anyone know how can I replace this 2 symbol below from the string
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I have some data like this: 1 2 3 4 5 9 2 6
link Im having trouble converting the html entites into html characters, (&# 8217;) i

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.