Description
Environment
Provide version numbers for the following components (information can be retrieved by running tns info
in your project folder or by inspecting the package.json
of the project):
- CLI: v5.4.0
- Cross-platform modules:
- Android Runtime:
- iOS Runtime: v5.4.0
- Plugin(s):
Describe the bug
When using application in worker thread, the app might crash when the worker is terminating and the application is sending a notification at the same time.
This is because NSNotificationCenter calls the observer from the main thread, and calls the function in the worker thread, while its deallocating the observer. Which then causes invalid memory access and then crashes.
relevant code lines:
https://github.com/NativeScript/NativeScript/blob/master/tns-core-modules/application/application.ios.ts#L86
https://github.com/NativeScript/NativeScript/blob/master/tns-core-modules/application/application.ios.ts#L122
To Reproduce
Expected behavior
application should unregister the observers on dealloc. Or another generic way to know which observers where added in the worker thread and remove them.
Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.
Metadata
Metadata
Assignees
Labels
Type
Projects
Status