Sfoglia il codice sorgente

bug report: code clean up

Gleb Pinigin 11 anni fa
parent
commit
9349e72c6d
1 ha cambiato i file con 8 aggiunte e 14 eliminazioni
  1. 8 14
      AspenProject/VLCBugreporter.m

+ 8 - 14
AspenProject/VLCBugreporter.m

@@ -12,27 +12,21 @@
 
 @implementation VLCBugreporter
 
-static VLCBugreporter *_sharedInstance = nil;
+#pragma mark - Initialization
 
 + (VLCBugreporter *)sharedInstance
 {
-    return _sharedInstance ? _sharedInstance : [[self alloc] init];
-}
-
-#pragma mark -
-#pragma mark Initialization
-
-- (id)init
-{
-    if (_sharedInstance) {
-        self = nil;
-        return _sharedInstance;
-    } else
-        _sharedInstance = [super init];
+    static dispatch_once_t onceToken;
+    static VLCBugreporter *_sharedInstance = nil;
+    dispatch_once(&onceToken, ^{
+        _sharedInstance = [VLCBugreporter new];
+    });
 
     return _sharedInstance;
 }
 
+#pragma mark -
+
 - (void)handleBugreportRequest
 {
     UIAlertView *alert = [[UIAlertView alloc]