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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T15:38:20+00:00 2026-05-13T15:38:20+00:00

I’m posting this question again but this time I’m including the full code. It’s

  • 0

I’m posting this question again but this time I’m including the full code. It’s extremely long, but here goes nothing. I don’t know where to release thePath? I believe it’s the last of my leaks, hopefully.

-(void)MoveObject:(int)Tag
    {   
        representationX = gameViewObj.spaceshipImageView.center.x;
        representationY = gameViewObj.spaceshipImageView.center.y;

        CALayer *spaceshipLayer = gameViewObj.spaceshipImageView.layer;
        shipAnimation = [CAKeyframeAnimation animationWithKeyPath:@"position"];
        CGMutablePathRef thePath = CGPathCreateMutable();
        CGPathMoveToPoint(thePath, NULL, representationX, representationY);
        statusFire = YES;
        BOOL parsedF = NO;

        if(Tag==LeftButtonTag)
        {   
            gameViewObj.spaceshipImageView.transform = CGAffineTransformMakeRotation(M_PI + M_PI_2);

            previousButtonTag = LeftButtonTag;
            representationX--;
            CGPathAddLineToPoint(thePath, NULL,representationX, representationY);

            parsedF = YES;
        }   
        else if(Tag==UpButtonTag)
        {
            gameViewObj.spaceshipImageView.transform = CGAffineTransformMakeRotation(0);

            previousButtonTag = UpButtonTag;
            representationY--;

            CGPathAddLineToPoint(thePath, NULL,representationX, representationY);

            parsedF = YES;
        }
        else if(Tag==RightButtonTag)
        {
            gameViewObj.spaceshipImageView.transform = CGAffineTransformMakeRotation(M_PI/2);

            previousButtonTag = RightButtonTag;
            representationX++;

            CGPathAddLineToPoint(thePath, NULL,representationX, representationY);

            parsedF = YES;
        }
        else if(Tag==DownButtonTag)
        {
            gameViewObj.spaceshipImageView.transform = CGAffineTransformMakeRotation(M_PI);

            previousButtonTag = DownButtonTag;
            representationY++;

            CGPathAddLineToPoint(thePath, NULL,representationX, representationY);

            parsedF = YES;
        }

        if(parsedF){

            shipAnimation.path = thePath;
            shipAnimation.delegate = self;
            shipAnimation.duration = 0.003;
            [spaceshipLayer addAnimation:shipAnimation forKey:@"position"];

            //To kill spaceship when moved backwards.
            if(playField[representationX][representationY]==3){

                [self doDie];
            }

            if(playField[representationX][representationY] == 2){

                if(onSecretLine){

                    [gameViewObj.spaceshipImageView setCenter:CGPointMake(representationX, representationY)];

                    oldPositionX = representationX;
                    oldPositionY = representationY;
                }
            }

            // case: breaking out
            if (playField[representationX][representationY]==0){
                if (onSecretLine){
                    if (statusFire)
                    {
                        availableOffline = YES;

                        oldPositionX=gameViewObj.spaceshipImageView.center.x;
                        oldPositionY=gameViewObj.spaceshipImageView.center.y;

                        [gameViewObj DrawLine];

                        onSecretLine = NO;
                        availableOffline = NO;
                    }
                }
            }

            if (playField[representationX][representationY]==0)
                if (!onSecretLine)
                {
                    BOOL doIt=true;

                    // ------------------------------
                    // prevent contact own line
                    // ------------------------------
                    // left 
                    if (Tag==LeftButtonTag) { 
                        if (playField[representationX-1][representationY]==3) {

                            [self doDie];
                            doIt=false;
                        }
                    }
                    // right 
                    if (Tag==RightButtonTag) { 
                        if (playField[representationX+1][representationY]==3) {

                            [self doDie];
                            doIt=false;
                        }
                    }
                    // up 
                    if (Tag==UpButtonTag) { 
                        if (playField[representationX][representationY-1]==3) {

                            [self doDie]; 
                            doIt=false;
                        }
                    }
                    // down 
                    if (Tag==DownButtonTag) {
                        if (playField[representationX][representationY+1]==3) {

                            [self doDie];
                            doIt=false;
                        }
                    }

                    // special things ...
                    if (doIt)
                    {
                        playField[representationX][representationY]=3;

                        [gameViewObj DrawLine];
                    }

                }

            // case: back to the secure line
            if (playField[representationX][representationY]==2)
                if (!onSecretLine)
                {               
                    [gameViewObj.spaceshipImageView setCenter:CGPointMake(representationX, representationY)];
                    availableOffline = NO;  
                    onSecretLine = YES;
                    [[NSNotificationCenter defaultCenter] postNotificationName:@"FindBirdCenter" object:nil];

                    for (int i=0; i<[gameViewObj.birdImageViewArray count]; i++) {
                        UIImageView* ImgBird=[gameViewObj.birdImageViewArray objectAtIndex:i];
                        int px=ImgBird.center.x;
                        int py=ImgBird.center.y;
                        // cristall point
                        playField[px][py]=5;
                    }

                    [self fillPlaygroundExtended];

                    //Elan function for filling area enclosed
                    [self fillAreaEnclosed:gameViewObj._myContext];

                    // invert ..
                    [self invertPlayground];

                    // turn the 3 into -> 20+
                    [self generateNewSecureLine];

                }

            if(Tag == UpButtonTag){

                [self moveShipUp];
            }

            else if(Tag == RightButtonTag){

                [self moveShipRight];
            }

            else if(Tag == DownButtonTag){

                [self moveShipDown];
            }

            else if(Tag == LeftButtonTag){

                [self moveShipLeft];

            }
            if(doScore == YES){
                [self calculateScore];
                doScore = NO;
            }
            [gameViewObj setNeedsDisplay];
        }
    }
  • 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-13T15:38:21+00:00Added an answer on May 13, 2026 at 3:38 pm

    Actually if you look at CAKeyframeAnimation interface in CAAnimation.h, it declares its path property like,

    @property CGPathRef path;
    

    Since the default is an ‘assign’ property, you shouldn’t release the thePath variable if you assign it to shipAnimation.path. You should release it only in case where you don’t assign it to shipAnimation.path.

    So I would say you add an else to your following loop

    if (parsedF) {
      ...
    } else {
      CFPathRelease(thePath);
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 393k
  • Answers 393k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer The memory for the UIImageView is always in memory as… May 15, 2026 at 1:55 am
  • Editorial Team
    Editorial Team added an answer Found it out! Here's my function for doing this. Your… May 15, 2026 at 1:55 am
  • Editorial Team
    Editorial Team added an answer I don't remember offhand if Hibernate actually stores PreparedStatement instances… May 15, 2026 at 1:55 am

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.