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

  • SEARCH
  • Home
  • 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 680221
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T01:20:52+00:00 2026-05-14T01:20:52+00:00

I tried everything to debug this one but I can’t get to the bottom

  • 0

I tried everything to debug this one but I can’t get to the bottom of it.

This code lives in a subclass of NSOperation which is processed from a queue:

(borders is an ivar NSArray containing 5 UIimage objects)


NSMutableArray *images = [[NSMutableArray alloc] init];

for (unsigned i = 0; i < 5; i++)
    {       

    CGSize size = CGSizeMake(60, 60);
    UIGraphicsBeginImageContext(size);

    CGPoint thumbPoint = CGPointMake(6, 6);

    [controller.image drawAtPoint:thumbPoint];

    CGPoint borderPoint = CGPointMake(0, 0);
    [[borders objectAtIndex:i] drawAtPoint:borderPoint];

    [images addObject:UIGraphicsGetImageFromCurrentImageContext()];

    UIGraphicsEndImageContext();

}

[images release];

The code works fine most of the time but when I push the iphone by access subviews and pressing lots of buttons on the UI I either get this exception which is trapped by the operation:

Exception Load view: *** -[NSCFArray insertObject:atIndex:]: attempt to insert nil

or I get this:

Program received signal:  “EXC_BAD_ACCESS”.

The exception is caused because UIGraphicsGetImageFromCurrentImageContext() return nil.

I don’t know how to debug the EXC_BAD_ACCESS but I’m guessing that this error (in fact both of these errors) is caused by low memory. The debugger stops at the line:

    [controller.image drawAtPoint:thumbPoint];

As I mentioned I’ve trapped the exception so I can live with that but the EXC_BAD_ACCESS is more serious.

IF this is memory related how can I tell and is it possible to increase the memory available to NSOperation?

  • 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-14T01:20:53+00:00Added an answer on May 14, 2026 at 1:20 am

    Is the NSOperationQueue being processed on the main thread or a background thread? If the latter you will not be able to do any graphics context stuff (or sometimes you will sometimes you won’t).

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

Sidebar

Related Questions

I have tried everything I can think of to get this event to trigger
I want to highlight everything between #ifdef DEBUG and #endif I tried this: syntax
I have tried EVERY single script/code/method posted on StackOverflow and other sites for this,
I have everything installed. But when I run rake db:create, I get the following:
I am hoping that someone can help me answer this question. I am writing
Everything was working perfectly fine in Xcode 3 yesterday before I upgraded. So I
We have a simple WCF (on .NET 4.0) Service which uses Windows authentication and
we're currently building a data warehouse using OWB (Oracle Warehouse Builder). One of the
OK, so I wrote an app using CodeIgniter 1.7.3 and everything was dandy. then
I'm experiencing a very strange problem with Rails and ajax using jQuery (although 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.