[vlc-devel] commit: macosx: fixed update mechanism for release builds ( Felix Paul Kühne )

git version control git at videolan.org
Wed Jul 29 17:48:56 CEST 2009


vlc | branch: 1.0-bugfix | Felix Paul Kühne <fkuehne at videolan.org> | Wed Jul 29 17:48:34 2009 +0200| [974a6ad265924ebb458ae4dddd4c7a98efe63dab] | committer: Felix Paul Kühne 

macosx: fixed update mechanism for release builds

This will still assert in debug build due to a core bug

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

 modules/gui/macosx/intf.m   |    8 ++++----
 modules/gui/macosx/update.h |    6 ++----
 modules/gui/macosx/update.m |   28 +++++++++++++---------------
 3 files changed, 19 insertions(+), 23 deletions(-)

diff --git a/modules/gui/macosx/intf.m b/modules/gui/macosx/intf.m
index 2245374..80ae726 100644
--- a/modules/gui/macosx/intf.m
+++ b/modules/gui/macosx/intf.m
@@ -813,10 +813,6 @@ static VLCMain *_o_sharedMainInstance = nil;
     /* remove global observer watching for vout device changes correctly */
     [[NSNotificationCenter defaultCenter] removeObserver: self];
 
-#ifdef UPDATE_CHECK
-    [o_update end];
-#endif
-
     /* release some other objects here, because it isn't sure whether dealloc
      * will be called later on */
     if( nib_about_loaded )
@@ -848,6 +844,10 @@ static VLCMain *_o_sharedMainInstance = nil;
     if( nib_wizard_loaded )
         [o_wizard release];
 
+#ifdef UPDATE_CHECK
+    [o_update release]; 
+#endif
+
     [crashLogURLConnection cancel];
     [crashLogURLConnection release];
  
diff --git a/modules/gui/macosx/update.h b/modules/gui/macosx/update.h
index 0db8b0d..046ab55 100644
--- a/modules/gui/macosx/update.h
+++ b/modules/gui/macosx/update.h
@@ -1,7 +1,7 @@
 /*****************************************************************************
  * update.h: MacOS X Check-For-Update window
  *****************************************************************************
- * Copyright © 2005-2008 the VideoLAN team
+ * Copyright (C) 2005-2009 the VideoLAN team
  * $Id$
  *
  * Authors: Felix Kühne <fkuehne at users.sf.net>
@@ -43,12 +43,10 @@
     IBOutlet id o_bar_checking;
     IBOutlet id o_chk_updateOnStartup;
 
-    update_t * p_u;
+    update_t * p_update;
     bool b_checked;
 }
 
-- (void)end;
-
 - (IBAction)download:(id)sender;
 - (IBAction)okay:(id)sender;
 - (IBAction)changeCheckUpdateOnStartup:(id)sender;
diff --git a/modules/gui/macosx/update.m b/modules/gui/macosx/update.m
index 766e59b..b35b85a 100644
--- a/modules/gui/macosx/update.m
+++ b/modules/gui/macosx/update.m
@@ -1,10 +1,10 @@
 /*****************************************************************************
  * update.m: MacOS X Check-For-Update window
  *****************************************************************************
- * Copyright © 2005-2008 the VideoLAN team
+ * Copyright (C) 2005-2009 the VideoLAN team
  * $Id$
  *
- * Authors: Felix Kühne <fkuehne at users.sf.net>
+ * Authors: Felix Paul Kühne <fkuehne at users.sf.net>
  *          Rafaël Carré <funman at videolanorg>
  *
  * This program is free software; you can redistribute it and/or modify
@@ -60,9 +60,10 @@ static VLCUpdate *_o_sharedInstance = nil;
     return _o_sharedInstance;
 }
 
-- (void)end
+- (void)dealloc
 {
-    if( p_u ) update_Delete( p_u );
+    if( p_update ) update_Delete( p_update );
+    [super dealloc];
 }
 
 - (void)awakeFromNib
@@ -142,7 +143,7 @@ static VLCUpdate *_o_sharedInstance = nil;
     [saveFilePanel setRequiredFileType: @"dmg"];
     [saveFilePanel setCanSelectHiddenExtension: YES];
     [saveFilePanel setCanCreateDirectories: YES];
-    update_release_t *p_release = update_GetRelease( p_u );
+    update_release_t *p_release = update_GetRelease( p_update );
     assert( p_release );
     [saveFilePanel beginSheetForDirectory:@"~/Downloads" file:
         [[[NSString stringWithUTF8String: p_release->psz_url] componentsSeparatedByString:@"/"] lastObject]
@@ -186,7 +187,7 @@ static VLCUpdate *_o_sharedInstance = nil;
     }
     else
     {
-        update_release_t *p_release = update_GetRelease( p_u );
+        update_release_t *p_release = update_GetRelease( p_update );
         [o_fld_releaseNote setString: [NSString stringWithUTF8String: (p_release->psz_desc ? p_release->psz_desc : "" )]];
         [o_fld_status setStringValue: _NS("This version of VLC is outdated.")];
         [o_fld_currentVersion setStringValue: [NSString stringWithFormat:
@@ -204,17 +205,17 @@ static void updateCallback( void * p_data, bool b_success )
 {
     VLCUpdate * update = p_data;
     NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
-    NSNumber * state = [NSNumber numberWithBool:!b_success || !update_NeedUpgrade( update->p_u )];
+    NSNumber * state = [NSNumber numberWithBool:!b_success || !update_NeedUpgrade( update->p_update )];
     [update performSelectorOnMainThread:@selector(setUpToDate:) withObject:state waitUntilDone:YES];
     [pool release];
 }
 
 - (void)checkForUpdate
 {
-    p_u = update_New( VLCIntf );
-    if( !p_u )
+    p_update = update_New( VLCIntf );
+    if( !p_update )
         return;
-    update_Check( p_u, updateCallback, self );
+    update_Check( p_update, updateCallback, self );
 
     NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
     [[NSUserDefaults standardUserDefaults] setObject: [NSDate date] forKey: kPrefUpdateLastTimeChecked];
@@ -224,12 +225,9 @@ static void updateCallback( void * p_data, bool b_success )
 - (void)performDownload:(NSString *)path
 {
     NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
-    update_Download( p_u, [path UTF8String] );
-    [o_btn_DownloadNow setEnabled: NO];
     [o_update_window orderOut: self];
-    update_WaitDownload( p_u );
-    update_Delete( p_u );
-    p_u = nil;
+    update_Download( p_update, [path UTF8String] );
+    [o_btn_DownloadNow setEnabled: NO];
     [pool release];
 }
 




More information about the vlc-devel mailing list