sduelund / mobitest-agent

Automatically exported from code.google.com/p/mobitest-agent
0 stars 0 forks source link

Fixed a crash in BZAgentController #8

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
I got a crash in BZAgentController.mm method

- (void)jobCompleted:(BZJob*)job withResult:(BZResult*)result

at line

result.screenShotImageQuality = job.screenShotImageQuality;

This is because "job" is owned by the BZWebViewController, which is dealloced 
after

[self dismissModalViewControllerAnimated:NO];

As a result "job" is released, which leads to a exception when trying to access 
the poperty "screenShotImageQuality".

Solution:
Just move the line 

result.screenShotImageQuality = job.screenShotImageQuality;

before the line 

[self dismissModalViewControllerAnimated:NO];

and everything works fine.

Thanks,
Oliver

P.S.: The resulting code after the fix:

- (void)jobCompleted:(BZJob*)job withResult:(BZResult*)result
{   
#if BZ_DEBUG_PRINT_HAR
    NSLog(@"Job completed");
#endif

    result.screenShotImageQuality = job.screenShotImageQuality;

    //Dismiss the web view
    [self dismissModalViewControllerAnimated:NO];

    [idleView showUploading:@"Job succeeded"];

    // Compress screenshots with the image quality setting of the job.

    busy = NO;

    [self restartIfRequired];

    [self processNextJob:YES];
}

See also the fixed source attached.

Original issue reported on code.google.com by oliver.w...@gmail.com on 20 Nov 2012 at 4:13

Attachments:

GoogleCodeExporter commented 8 years ago
This issue was closed by revision r34.

Original comment by guy...@gmail.com on 30 Nov 2012 at 5:51

GoogleCodeExporter commented 8 years ago
I couldn't reproduce the crash, but I understand the logic and don't see much 
harm in making the change. I made the change and checked in the code.

Original comment by guy...@gmail.com on 30 Nov 2012 at 5:52