[vlc-commits] macosx: Remove flawed cell initialization

Marvin Scholz git at videolan.org
Wed Aug 16 00:47:39 CEST 2017


vlc | branch: master | Marvin Scholz <epirat07 at gmail.com> | Tue Aug 15 22:12:11 2017 +0200| [5e8ad617ff51f18fdd97a0cdf2a236d8516ac120] | committer: Marvin Scholz

macosx: Remove flawed cell initialization

The developer needs to ensure the Cell class is set correctly in IB,
as there is no good way to do this the right way in code, without
loosing all settings from IB for the cell.

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

 modules/gui/macosx/VLCDefaultValueSlider.m |  5 ++---
 modules/gui/macosx/VLCSlider.m             | 13 ++-----------
 modules/gui/macosx/VLCVolumeSlider.m       |  5 ++---
 3 files changed, 6 insertions(+), 17 deletions(-)

diff --git a/modules/gui/macosx/VLCDefaultValueSlider.m b/modules/gui/macosx/VLCDefaultValueSlider.m
index 16e689a467..8e6ae1c7a9 100644
--- a/modules/gui/macosx/VLCDefaultValueSlider.m
+++ b/modules/gui/macosx/VLCDefaultValueSlider.m
@@ -30,9 +30,8 @@
 {
     self = [super initWithCoder:coder];
     if (self) {
-        if (![self.cell isKindOfClass:[VLCDefaultValueSliderCell class]]) {
-            self.cell = [[VLCDefaultValueSliderCell alloc] init];
-        }
+        NSAssert([self.cell isKindOfClass:[VLCDefaultValueSliderCell class]],
+                 @"VLCDefaultSlider cell is not VLCDefaultValueSliderCell");
         _isScrollable = YES;
     }
     return self;
diff --git a/modules/gui/macosx/VLCSlider.m b/modules/gui/macosx/VLCSlider.m
index 787721ecf3..245c4faab0 100644
--- a/modules/gui/macosx/VLCSlider.m
+++ b/modules/gui/macosx/VLCSlider.m
@@ -31,9 +31,8 @@
     self = [super initWithCoder:coder];
 
     if (self) {
-        if (![self.cell isKindOfClass:[VLCSliderCell class]]) {
-            self.cell = [[VLCSliderCell alloc] init];
-        }
+        NSAssert([self.cell isKindOfClass:[VLCSliderCell class]],
+                 @"VLCSlider cell is not VLCSliderCell");
     }
     return self;
 }
@@ -49,14 +48,6 @@
     [super setNeedsDisplayInRect:[self bounds]];
 }
 
-- (void)awakeFromNib {
-    [super awakeFromNib];
-
-    if(![self.cell isKindOfClass:[VLCSliderCell class]]) {
-        self.cell = [[VLCSliderCell alloc] init];
-    }
-}
-
 - (BOOL)getIndefinite
 {
     return [(VLCSliderCell*)[self cell] indefinite];
diff --git a/modules/gui/macosx/VLCVolumeSlider.m b/modules/gui/macosx/VLCVolumeSlider.m
index 300dbdf545..b912f9c7c4 100644
--- a/modules/gui/macosx/VLCVolumeSlider.m
+++ b/modules/gui/macosx/VLCVolumeSlider.m
@@ -32,9 +32,8 @@
     self = [super initWithCoder:coder];
 
     if (self) {
-        if (![self.cell isKindOfClass:[VLCVolumeSliderCell class]]) {
-            self.cell = [[VLCVolumeSliderCell alloc] init];
-        }
+        NSAssert([self.cell isKindOfClass:[VLCVolumeSliderCell class]],
+                 @"VLCVolumeSlider cell is not VLCVolumeSliderCell");
     }
     return self;
 }



More information about the vlc-commits mailing list