views:

154

answers:

0

Hi all

I receive that message in debugger console since I added the following arguments for debugging my application with XCode.

NSZombieEnabled: YES NSZombieLevel: 16

I was looking for zombie objects... Before doing so, the application failed before I could know where what and why was happening.... Now I´m pretty sure that 'something' outside code is trying to access an object previously released and I can't know where or why it happens neither where it was released...

My application is based on this proof of concept (very interesting and colorful) of QuartzCore Framework:

http://www.cimgf.com/2008/03/03/core-animation-tutorial-wizard-dialog-with-transitions/

Based on it, I added a few more nsviews to my project and a title and an index to each one, also I added some buttons, text and images depending on what 'dialog' (ACLinkedView object) it was...

The transition from an ACLinkedView object to another is going through a validation that depends on the view where you are ...

As you see I used this proof of concept as the foundation of my application and it grew and grew into an application that makes use of configuration files, web services (using gSOAP and C ...)

I hope you can give me some clues to where is my error ... I´ve been the hole week debugging unsuccessfully, as I said before, I think that that message comes from a point outside my code. I'd say that the problem s related with bad memory allocation or automatisms (nearly completely unknowns for me) during loading the nib components...

I will try to explain all this with parts of mycode.

This is my ACLinkedView definition:

#import <Cocoa/Cocoa.h>


@interface ACLinkedView : NSView
{
    // The Window (to close it if needed)
    IBOutlet NSWindow *mainWindow;

    // Linked Views
    IBOutlet ACLinkedView *previousView;
    IBOutlet ACLinkedView *nextView;

    // Buttons      
    IBOutlet NSButton *previousButton;
    IBOutlet NSButton *nextButton;  
    IBOutlet NSButton *helpButton; //It has to be a Button!!    
    IBOutlet NSImageView *bannerImg;    

    NSString *sName;
    int iPosition;
}


- (void) SetName: (NSString*) Name;
- (void) SetPosition: (int) Position;
- (NSString*) GetName;
- (int) GetPosition;
- (void) windowWillClose:(NSNotification*)aNotification;

@property (retain) NSWindow *mainWindow;
@property (retain) ACLinkedView *previousView, *nextView;
@property (retain) NSButton *previousButton, *nextButton, *helpButton;
@property (retain) NSImageView *bannerImg;  
@property (retain) NSString *sName; 


@end

The ACLinkedView's AwakeFromNib is this:

- (void) awakeFromNib
{
    @try
    {
        [self setWantsLayer:YES];
        //With this we will close the entire app if a View is closed by pressing the red close button
        [mainWindow setDelegate:self];// We have to override - (void) windowWillClose:(NSNotification*)aNotification;       
        //usleep(100);
        if(previousView == nil)
        {
            [previousButton setTransparent:TRUE];
            [self SetPosition: 0];
            [self SetName: @"WelcomeDialog"];
            NSLog(@"TRAZA: Creado WelcomeDialog: %d", self);
        }
        else if([self.previousView previousView] == nil)
        {
            [self SetName: @"UseConditionsDialog"];
            [self SetPosition:1];
            NSLog(@"TRAZA: Creado UseConditionsDialog: %d", self);
        }
        else if([[self.previousView previousView] previousView] == nil)
        {
            [self SetName: @"LicenseDialog"];
            [self SetPosition:2];
            NSLog(@"TRAZA: Creado LicenseDialog: %d", self);

        }
        else if([[[self.previousView previousView] previousView] previousView]== nil)
        {
            [self SetName: @"FormDialog"];
            [self SetPosition:3];
            NSLog(@"TRAZA: Creado FormDialog: %d", self);
        }
        else if([[[[self.previousView previousView] previousView] previousView]previousView]== nil)
        {
            [self SetName: @"EndDialog"];           
            [self SetPosition:4];   
            NSLog(@"TRAZA: Creado EndDialog: %d", self);
        }   

        NSString *banneerImagePath =[[NSBundle mainBundle] pathForResource:@"Banner" ofType:@"bmp"];
        NSImage *theBannerImage = [[NSImage alloc] initWithContentsOfFile:banneerImagePath];

        NSString *helpImagePath =[[NSBundle mainBundle] pathForResource:@"help" ofType:@"bmp"];
        NSImage *theHelpImage = [[NSImage alloc] initWithContentsOfFile:helpImagePath];

        if (theBannerImage)
        {
            [bannerImg setImage:theBannerImage];            
        }
        if (theHelpImage)
        {           
            [helpButton setImage:theHelpImage];
        }

    }
    @catch (NSException * e) 
    { 
        NSLog(@" EXCEPTION in ACLinkedView::awakeFromNib:\nReason: %@", [[e reason] UTF8String]);
    }
    @finally
    {       
        return;
    }   
}

(As you can see the initialization of each ACLinkedView object depends on it's position wich is seted up into the Interface Builder by linking actions, buttons and CustomViews...

Does I explain enough? Do you think that I should put more of my code here, i.e. AppDelegate definition or it´s awakeFromNib method? Can you help me in any way?

Thanks in advance.

Juan

28 June 2010

I´m still having this problem once each 5-10 times:

2010-06-28 10:34:58.502 setup[3332:a0f] * -[NSCustomView isOpaque]: message sent to deallocated instance 0x218270 sharedlibrary apply-load-rules all

I added something like this to each init method and I couldn´t find the creation of that deallocated instance... And I´m getting crazy!

I need help or new advices.

Thanks

JxXx


I also added NSAutoreleaseFreedObjectCheckEnabled YES and NSDebugEnabled YES as variables to be set int the environment by editing active executable...

Nothing. No results...

2010-06-28 13:31:29.543 setup[6310:a0f] * -[NSCustomView isOpaque]: message sent to deallocated instance 0x11ec70 sharedlibrary apply-load-rules all

I´m Still having the same problem:

Look at this code:

   int main(int argc, char *argv[])
{
    int iReturnValue;
    @try 
    {
        NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
        iReturnValue = NSApplicationMain(argc,  (const char **) argv);
        [pool drain];
    }
    @catch (NSException * e)
    {
        NSLog(@"EXCPTION IN MAIN METHOD!!!!!");
    }
    @finally 
    {       
        return iReturnValue;
    }

}

and:

2010-07-07 16:47:31.121 setup[3844:a0f] -[NSCFString isOpaque]: unrecognized selector sent to instance 0x14b000 2010-07-07 16:47:31.122 setup[3844:a0f] EXCPTION IN MAIN METHOD!!!!!