Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

App Crash: An instance 0xXXXXXXXX of class Charts.BarChartView was deallocated while key value observers were still registered with it. #1368

Closed
jakarmy opened this issue Aug 28, 2016 · 1 comment

Comments

@jakarmy
Copy link

jakarmy commented Aug 28, 2016

I'm adding a BarChartView to a CollectionView-like class that deallocates and reuses cells. I add to one of these cells a BarChartView, and when you scroll up and down, the app crashes with this error:

App Crash:
An instance 0x7cba6e00 of class Charts.BarChartView was deallocated while key value observers were still registered with it. Current observation info: <NSKeyValueObservationInfo 0x7e4626a0> (
<NSKeyValueObservance 0x7c0d6090: Observer: 0x7cba6e00, Key path: bounds, Options: <New: YES, Old: NO, Prior: NO> Context: 0x0, Property: 0x7c0d60c0>
<NSKeyValueObservance 0x7c0cb910: Observer: 0x7cba6e00, Key path: frame, Options: <New: YES, Old: NO, Prior: NO> Context: 0x0, Property: 0x7c0cb940>
)
2016-08-28 20:06:01.937 VirtualStatBasic[14383:2869686] Stack Trace:
(
0 CoreFoundation 0x055a8494 exceptionPreprocess + 180
1 libobjc.A.dylib 0x05062e02 objc_exception_throw + 50
2 CoreFoundation 0x055a83bd +[NSException raise:format:] + 141
3 Foundation 0x04c9b097 NSKVODeallocate + 353
4 UIKit 0x03fd6348 -[UIView(UIKitManual) release] + 142
5 CoreFoundation 0x05457df7 CFRelease + 727
6 CoreFoundation 0x0546dbfe -[__NSArrayM dealloc] + 142
7 libobjc.A.dylib 0x05076060 _ZN11objc_object17sidetable_releaseEb + 238
8 libobjc.A.dylib 0x05075361 objc_release + 65
9 libobjc.A.dylib 0x0507652d _ZN12_GLOBAL__N_119AutoreleasePoolPage3popEPv + 371
10 CoreFoundation 0x054788a8 _CFAutoreleasePoolPop + 24
11 Foundation 0x04c6e23f __NSFireDelayedPerform + 520
12 CoreFoundation 0x054f2136 __CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION
+ 22
13 CoreFoundation 0x054f1b32 __CFRunLoopDoTimer + 1250
14 CoreFoundation 0x054b039a __CFRunLoopRun + 2202
15 CoreFoundation 0x054af846 CFRunLoopRunSpecific + 470
16 CoreFoundation 0x054af65b CFRunLoopRunInMode + 123
17 GraphicsServices 0x0ad41664 GSEventRunModal + 192
18 GraphicsServices 0x0ad414a1 GSEventRun + 104
19 UIKit 0x036e6eb9 UIApplicationMain + 160
20 VirtualStatBasic 0x00008e0a main + 138
21 libdyld.dylib 0x05a54a25 start + 1
)

I believe the deallocation of cell-like objects containing the BarChartView might be causing the problem.

What would you suggest? Is there a way to remove the Key Value Observers?

@danielgindi
Copy link
Collaborator

The chart view removes any observes (to be exact: 2) that it registers (in init) - in dealloc, so I'm guessing there's a problem in your code in another place....

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants