[vlc-commits] vout: ios: init observer from constructor

Thomas Guillem git at videolan.org
Wed Mar 7 15:47:30 CET 2018


vlc/vlc-3.0 | branch: master | Thomas Guillem <thomas at gllm.fr> | Tue Mar  6 13:21:08 2018 +0100| [a6d75ed20726fa62dd75fb18e0645c3c422ec1a2] | committer: Thomas Guillem

vout: ios: init observer from constructor

This fixes a possible inconsistent state of the _appActive boolean if the apps
goes to background during the vout Open callback.

(cherry picked from commit c447a89650a0f3216500958661f0658d10740773)
Signed-off-by: Thomas Guillem <thomas at gllm.fr>

> http://git.videolan.org/gitweb.cgi/vlc/vlc-3.0.git/?a=commit;h=a6d75ed20726fa62dd75fb18e0645c3c422ec1a2
---

 modules/video_output/ios.m | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/modules/video_output/ios.m b/modules/video_output/ios.m
index e4cdeb0481..edc71d57f0 100644
--- a/modules/video_output/ios.m
+++ b/modules/video_output/ios.m
@@ -224,15 +224,6 @@ static int Open(vlc_object_t *this)
         vd->display = PictureDisplay;
         vd->control = Control;
 
-        /* */
-        [[NSNotificationCenter defaultCenter] addObserver:sys->glESView
-                                                 selector:@selector(applicationStateChanged:)
-                                                     name:UIApplicationWillResignActiveNotification
-                                                   object:nil];
-        [[NSNotificationCenter defaultCenter] addObserver:sys->glESView
-                                                 selector:@selector(applicationStateChanged:)
-                                                     name:UIApplicationDidBecomeActiveNotification
-                                                   object:nil];
         return VLC_SUCCESS;
 
     bailout:
@@ -445,6 +436,15 @@ static void GLESSwap(vlc_gl_t *gl)
         return nil;
     }
 
+    /* */
+    [[NSNotificationCenter defaultCenter] addObserver:self
+                                             selector:@selector(applicationStateChanged:)
+                                                 name:UIApplicationWillResignActiveNotification
+                                               object:nil];
+    [[NSNotificationCenter defaultCenter] addObserver:self
+                                             selector:@selector(applicationStateChanged:)
+                                                 name:UIApplicationDidBecomeActiveNotification
+                                               object:nil];
     return self;
 }
 



More information about the vlc-commits mailing list