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 8743947
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T11:45:56+00:00 2026-06-13T11:45:56+00:00

My app crashes (occasionally – Mostly after 8 to 10 runs) – when I

  • 0

My app crashes (occasionally – Mostly after 8 to 10 runs) – when I call CFDataGetBytePtr. Basically I want to copy pixel bytes from image and store in a buffer when I can manipulate further. Is it because I am not releasing m_PixelBuf? Or is it the wrong way to copy data?

+ (int**) UIImage2GrayInt:(UIImage*)inImage
{
CGImageRef cgImage = inImage.CGImage;
CFDataRef m_DataRef = CGDataProviderCopyData(CGImageGetDataProvider(cgImage));  
UInt8 *m_PixelBuf = (UInt8 *) CFDataGetBytePtr(m_DataRef);  
int m_iH = CGImageGetHeight(cgImage);
int m_iW = CGImageGetWidth(cgImage);
//short* m_inDataGrey = malloc(sizeof(short)*(m_iW*m_iH));

int**piData = [self initVal:m_iH:m_iW];
//Convert GreyScale and copy data
int iStep,jStep;


for (int i = 0; i < m_iH; i++) 
{
    iStep = i*m_iW*4;
    //iStepGrey = i*m_iW;
    for (int j = 0; j < m_iW; j++) 
    {
        jStep = j*4;
        piData[i][j] =   ((double)m_PixelBuf[iStep + jStep] + (double)m_PixelBuf[iStep + jStep +1] + (double)m_PixelBuf[iStep + jStep +2])/3.0;
    }
}

m_PixelBuf = NULL;
CFRelease(m_DataRef);
return piData;
}

Here are the crash logs

1.  0 MyApp 0x000606ae testflight_backtrace + 238
    2.  1 MyApp 0x00061398 TFSignalHandler + 264
    3.  2 libsystem_c.dylib 0x328b87ec _sigtramp + 48
    4.  3 MyApp 0x00046fa4 +[clsGlobalHelper UIImage2GrayInt:] (clsGlobalHelper.m:276)
    5.  4 MyApp 0x00046fa4 +[clsGlobalHelper UIImage2GrayInt:] (clsGlobalHelper.m:276)
    6.  5 MyApp 0x00046d40 +[clsGlobalHelper resizeImageAvg:::] (clsGlobalHelper.m:212)
    7.  6 MyApp 0x00036fd2 -[clsNewPhoto ProcessSelectedFace] (clsFirstViewController.m:618)
    8.  7 MyApp 0x000354ae -[clsNewPhoto btnSelectGender:] (clsFirstViewController.m:309)
    9.  8 CoreFoundation 0x354063fc -[NSObject performSelector:withObject:withObject:] + 52

Here is the code of initval

+(int**) initVal:(int) Nr:( int) Nc 
{
  int ** p;
  p = calloc(Nr,sizeof(int*));

  for(int i = 0; i < Nr; i++)
  {
    p[i] = calloc(Nc,sizeof(int));

  }
  return p;
}
  • 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-06-13T11:45:57+00:00Added an answer on June 13, 2026 at 11:45 am

    Answer from this question helped me solve the issue. Still don’t know what was the problem with CFDataGetBytePtr but atleast I have the solution to move forward.

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

Sidebar

Related Questions

my app crashes when the user tries to delete a row from the UITableView
My app crashes when I try to use the features of b2Body from within
My wp7 app crashes when I come back from a task such as Map,
My app crashes because of low memory. This is the extraction from low memory
App crashes after execution of cellForRowAtIndexPath method of tableView It goes into: UITableView(UITableViewInternal) _createPreparedCellForGlobalRow:withIndexPath:]
Occasionally, I'm seeing crashes originating from the -dealloc in SPTrack : Exception Type: EXC_BAD_ACCESS
My iphone app occasionally crashes on the simulator and device with this message in
If my C++ app crashes on Windows I want to send useful debugging information
My app crashes with this (after the end of viewDidLoad): -[NSPathStore2 release]: message sent
The app crashes about 15 seconds after launching and XCode just breaks at an

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.