Page 1 of 1

Cannot go into dealloc method

Posted: 13 Jan 2015 05:11
by trongdth
when running Dropin-Player sample for iOS, I found we cannot go into dealloc method at VDLPlaybackViewController page when pressing Done button. I guess there is something cannot be released.

Let me know if it's a bug or not!

Thanks

Re: Cannot go into dealloc method

Posted: 13 Jan 2015 19:12
by fkuehne
More information needed.

Re: Cannot go into dealloc method

Posted: 14 Jan 2015 06:24
by trongdth
Hi Felix,

Sorry for missing information.

Basically, I add dealloc method into VDLPlaybackViewController.m for Dropin-Player sample:

Code: Select all

- (void)viewWillDisappear:(BOOL)animated { [super viewWillDisappear:animated]; if (_mediaplayer) { @try { [_mediaplayer removeObserver:self forKeyPath:@"time"]; [_mediaplayer removeObserver:self forKeyPath:@"remainingTime"]; } @catch (NSException *exception) { NSLog(@"we weren't an observer yet"); } if (_mediaplayer.media) [_mediaplayer stop]; if (_mediaplayer) _mediaplayer = nil; } if (_idleTimer) { [_idleTimer invalidate]; _idleTimer = nil; } [self.navigationController setNavigationBarHidden:NO animated:YES]; [[UIApplication sharedApplication] setStatusBarHidden:NO withAnimation:UIStatusBarAnimationFade]; } - (void)dealloc { NSLog("it should be called"); }
then I run the application and watch the video. After that, I press DONE button. My expected result is I can see message "it should be called" in console log but it doesn't show anything.

In my opinion, I guessing there is something still not released inside VLCMediaPlayer. Therefore the view controller cannot call dealloc method.

Re: Cannot go into dealloc method

Posted: 16 Jan 2015 14:48
by fkuehne
We never release the view controller in this code sample, so this is why this method is never called.

Since the introduction of ARC, you should not rely on this function, unless it is really really necessary. We have similar code in VLC for iOS and dealloc is de facto unused.

Re: Cannot go into dealloc method

Posted: 21 Jan 2015 05:56
by trongdth
Thanks for quick response.

Totally agree with you with ARC dealloc method is unused but for life cycle it still goes inside the dealloc. For my scenario, i need to perform some cleanup on dealloc method so that's why I ask.

Anyway, i will try to cleanup at viewDidDisapear instead.