Commit 974a6ad2 authored by Felix Paul Kühne's avatar Felix Paul Kühne

macosx: fixed update mechanism for release builds

This will still assert in debug build due to a core bug
parent 1f1f81b9
...@@ -813,10 +813,6 @@ static VLCMain *_o_sharedMainInstance = nil; ...@@ -813,10 +813,6 @@ static VLCMain *_o_sharedMainInstance = nil;
/* remove global observer watching for vout device changes correctly */ /* remove global observer watching for vout device changes correctly */
[[NSNotificationCenter defaultCenter] removeObserver: self]; [[NSNotificationCenter defaultCenter] removeObserver: self];
#ifdef UPDATE_CHECK
[o_update end];
#endif
/* release some other objects here, because it isn't sure whether dealloc /* release some other objects here, because it isn't sure whether dealloc
* will be called later on */ * will be called later on */
if( nib_about_loaded ) if( nib_about_loaded )
...@@ -848,6 +844,10 @@ static VLCMain *_o_sharedMainInstance = nil; ...@@ -848,6 +844,10 @@ static VLCMain *_o_sharedMainInstance = nil;
if( nib_wizard_loaded ) if( nib_wizard_loaded )
[o_wizard release]; [o_wizard release];
#ifdef UPDATE_CHECK
[o_update release];
#endif
[crashLogURLConnection cancel]; [crashLogURLConnection cancel];
[crashLogURLConnection release]; [crashLogURLConnection release];
......
/***************************************************************************** /*****************************************************************************
* update.h: MacOS X Check-For-Update window * update.h: MacOS X Check-For-Update window
***************************************************************************** *****************************************************************************
* Copyright © 2005-2008 the VideoLAN team * Copyright (C) 2005-2009 the VideoLAN team
* $Id$ * $Id$
* *
* Authors: Felix Kühne <fkuehne@users.sf.net> * Authors: Felix Kühne <fkuehne@users.sf.net>
...@@ -43,12 +43,10 @@ ...@@ -43,12 +43,10 @@
IBOutlet id o_bar_checking; IBOutlet id o_bar_checking;
IBOutlet id o_chk_updateOnStartup; IBOutlet id o_chk_updateOnStartup;
update_t * p_u; update_t * p_update;
bool b_checked; bool b_checked;
} }
- (void)end;
- (IBAction)download:(id)sender; - (IBAction)download:(id)sender;
- (IBAction)okay:(id)sender; - (IBAction)okay:(id)sender;
- (IBAction)changeCheckUpdateOnStartup:(id)sender; - (IBAction)changeCheckUpdateOnStartup:(id)sender;
......
/***************************************************************************** /*****************************************************************************
* update.m: MacOS X Check-For-Update window * update.m: MacOS X Check-For-Update window
***************************************************************************** *****************************************************************************
* Copyright © 2005-2008 the VideoLAN team * Copyright (C) 2005-2009 the VideoLAN team
* $Id$ * $Id$
* *
* Authors: Felix Kühne <fkuehne@users.sf.net> * Authors: Felix Paul Kühne <fkuehne@users.sf.net>
* Rafaël Carré <funman@videolanorg> * Rafaël Carré <funman@videolanorg>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
...@@ -60,9 +60,10 @@ static VLCUpdate *_o_sharedInstance = nil; ...@@ -60,9 +60,10 @@ static VLCUpdate *_o_sharedInstance = nil;
return _o_sharedInstance; 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 - (void)awakeFromNib
...@@ -142,7 +143,7 @@ static VLCUpdate *_o_sharedInstance = nil; ...@@ -142,7 +143,7 @@ static VLCUpdate *_o_sharedInstance = nil;
[saveFilePanel setRequiredFileType: @"dmg"]; [saveFilePanel setRequiredFileType: @"dmg"];
[saveFilePanel setCanSelectHiddenExtension: YES]; [saveFilePanel setCanSelectHiddenExtension: YES];
[saveFilePanel setCanCreateDirectories: 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 ); assert( p_release );
[saveFilePanel beginSheetForDirectory:@"~/Downloads" file: [saveFilePanel beginSheetForDirectory:@"~/Downloads" file:
[[[NSString stringWithUTF8String: p_release->psz_url] componentsSeparatedByString:@"/"] lastObject] [[[NSString stringWithUTF8String: p_release->psz_url] componentsSeparatedByString:@"/"] lastObject]
...@@ -186,7 +187,7 @@ static VLCUpdate *_o_sharedInstance = nil; ...@@ -186,7 +187,7 @@ static VLCUpdate *_o_sharedInstance = nil;
} }
else 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_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_status setStringValue: _NS("This version of VLC is outdated.")];
[o_fld_currentVersion setStringValue: [NSString stringWithFormat: [o_fld_currentVersion setStringValue: [NSString stringWithFormat:
...@@ -204,17 +205,17 @@ static void updateCallback( void * p_data, bool b_success ) ...@@ -204,17 +205,17 @@ static void updateCallback( void * p_data, bool b_success )
{ {
VLCUpdate * update = p_data; VLCUpdate * update = p_data;
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init]; 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]; [update performSelectorOnMainThread:@selector(setUpToDate:) withObject:state waitUntilDone:YES];
[pool release]; [pool release];
} }
- (void)checkForUpdate - (void)checkForUpdate
{ {
p_u = update_New( VLCIntf ); p_update = update_New( VLCIntf );
if( !p_u ) if( !p_update )
return; return;
update_Check( p_u, updateCallback, self ); update_Check( p_update, updateCallback, self );
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init]; NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
[[NSUserDefaults standardUserDefaults] setObject: [NSDate date] forKey: kPrefUpdateLastTimeChecked]; [[NSUserDefaults standardUserDefaults] setObject: [NSDate date] forKey: kPrefUpdateLastTimeChecked];
...@@ -224,12 +225,9 @@ static void updateCallback( void * p_data, bool b_success ) ...@@ -224,12 +225,9 @@ static void updateCallback( void * p_data, bool b_success )
- (void)performDownload:(NSString *)path - (void)performDownload:(NSString *)path
{ {
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init]; NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
update_Download( p_u, [path UTF8String] );
[o_btn_DownloadNow setEnabled: NO];
[o_update_window orderOut: self]; [o_update_window orderOut: self];
update_WaitDownload( p_u ); update_Download( p_update, [path UTF8String] );
update_Delete( p_u ); [o_btn_DownloadNow setEnabled: NO];
p_u = nil;
[pool release]; [pool release];
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment