cordova-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Becky Gibson (JIRA)" <>
Subject [jira] [Assigned] (CB-1578) App crash (while stopping) caused by an unregistered notification handler in CDVConnection
Date Thu, 04 Oct 2012 21:43:49 GMT


Becky Gibson reassigned CB-1578:

    Assignee: Becky Gibson  (was: Shazron Abdullah)
> App crash (while stopping) caused by an unregistered notification handler in CDVConnection
> ------------------------------------------------------------------------------------------
>                 Key: CB-1578
>                 URL:
>             Project: Apache Cordova
>          Issue Type: Bug
>          Components: iOS
>    Affects Versions: 2.0.0, 2.1.0
>         Environment: iOS, all versions
> XCode, all versions
>            Reporter: Christoph Jerolimov
>            Assignee: Becky Gibson
>            Priority: Critical
> The class {{CDVConnection}} registered itself as observer for background events {{UIApplicationDidEnterBackgroundNotification}}
and {{UIApplicationWillEnterForegroundNotification}}. But it did NOT unregistered these calls,
for example in the dealloc method.
> This caused in different type of errors which all ends in an app crash. If a CDVConnection
instance was already removed from the memory the selectors onPause and onResume will be called
on random other objects which doesn't support this selector (1) or illegal memory access!
> {code}
> # Only an example, this error calls selectors on "random memory / objects"!
> <Error>: -[CALayer onPause]: unrecognized selector sent to instance 0x1e56ac50
> {code}
> The code which register the notification could be found at the end of the file in the
selector {{[CDVConnection initWithWebView:]}}.
> The versions 2.0.0 and 2.1.0 does NOT cleanup "only" the two mentioned events. Like you
see in line 139:
> The current HEAD do additionally NOT remove the the event {{kReachabilityChangedNotification}}
from line 113 which should result in another new bug in the upcoming version.
> To fix this it's enough to add these removeObservers calls again to the dealloc method.
> {code}
> [[NSNotificationCenter defaultCenter] removeObserver:self name:kReachabilityChangedNotification
> [[NSNotificationCenter defaultCenter] removeObserver:self name:UIApplicationDidEnterBackgroundNotification
> [[NSNotificationCenter defaultCenter] removeObserver:self name:UIApplicationWillEnterForegroundNotification
> {code}
> In generally it's would also be possible to remove the instance in CDVPlugin for all
events!? This would allow you to remove many code from many different plugins and ensure that
no other plugin forget these cleanup.
> {code}
> 	[[NSNotificationCenter defaultCenter] removeObserver:self];
> {code}

This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see:

View raw message