[UIImage size]: message sent to deallocated instance 0x8452560
===

i dont known why my app get bug when i try to rotate image in the second time

    -(UIImage *)rotateImage:(UIImage *)image{
        // calculate the size of the rotated view's containing box for our drawing space
        CGSize rotatedSize = image.size;
        
        // Create the bitmap context
        UIGraphicsBeginImageContext(rotatedSize);
        CGContextRef bitmap = UIGraphicsGetCurrentContext();
        
        // Move the origin to the middle of the image so we will rotate and scale around the center.
        CGContextTranslateCTM(bitmap, rotatedSize.width/2, rotatedSize.height/2);
        
        //   // Rotate the image context
        CGContextRotateCTM(bitmap, DegreesToRadians(90));
        
        // Now, draw the rotated/scaled image into the context
        CGContextScaleCTM(bitmap, 1.0, -1.0);
        CGContextDrawImage(bitmap, CGRectMake(-image.size.width / 2, -image.size.height / 2, image.size.width, image.size.height), image.CGImage);
        
        UIImage *newImage = UIGraphicsGetImageFromCurrentImageContext();
        UIGraphicsEndImageContext();
        return newImage;
    
    }

and i call this function by :
   

     NSLog(@"%f %f",rotatedOriginImage.size.width,rotatedOriginImage.size.height);
        rotatedOriginImage = [self rotateImage:rotatedOriginImage];

at the first time it log :

    2012-07-11 17:22:50.825 meshtiles[3330:707] 600.000000 600.000000

but at the second times:

    2012-07-11 17:22:55.253 meshtiles[3330:707] *** -[UIImage size]: message sent to deallocated instance 0x8452560

any support for this case, please help me


