Commit c3131c09 authored by Felix Paul Kühne's avatar Felix Paul Kühne

* fixed a crash when quitting VLC while scrolling the credits in the about...

* fixed a crash when quitting VLC while scrolling the credits in the about window. Additionally, improved the help window's memory print slightly
parent 20d9ce55
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/ *****************************************************************************/
#import <WebKit/WebKit.h> #import <WebKit/WebKit.h> //we need to be here, because we're using a WebView object below
/***************************************************************************** /*****************************************************************************
* VLAboutBox interface * VLAboutBox interface
...@@ -60,6 +60,7 @@ ...@@ -60,6 +60,7 @@
+ (VLAboutBox *)sharedInstance; + (VLAboutBox *)sharedInstance;
- (void)showAbout; - (void)showAbout;
- (void)VLCWillTerminate;
- (void)showHelp; - (void)showHelp;
- (IBAction)showGPL:(id)sender; - (IBAction)showGPL:(id)sender;
- (IBAction)helpGoHome:(id)sender; - (IBAction)helpGoHome:(id)sender;
......
...@@ -69,15 +69,20 @@ static VLAboutBox *_o_sharedInstance = nil; ...@@ -69,15 +69,20 @@ static VLAboutBox *_o_sharedInstance = nil;
{ {
if(! b_isSetUp ) if(! b_isSetUp )
{ {
NSDictionary *o_local_dict; /* we want to know when VLC wants to quit to prevent a crash while scrolling our credits */
[[NSNotificationCenter defaultCenter] addObserver: self
selector: @selector(VLCWillTerminate)
name: NSApplicationWillTerminateNotification
object: nil];
/* Get the localized info dictionary (InfoPlist.strings) */ /* Get the localized info dictionary (InfoPlist.strings) */
NSDictionary *o_local_dict;
o_local_dict = [[NSBundle mainBundle] localizedInfoDictionary]; o_local_dict = [[NSBundle mainBundle] localizedInfoDictionary];
/* Setup the name field */ /* Setup the copyright field */
[o_name_field setStringValue: [o_local_dict objectForKey:@"CFBundleName"]]; [o_copyright_field setStringValue: [o_local_dict objectForKey:@"NSHumanReadableCopyright"]];
/* Set the about box title */ /* Set the box title */
[o_about_window setTitle: _NS("About VLC media player")]; [o_about_window setTitle: _NS("About VLC media player")];
/* setup the creator / revision field */ /* setup the creator / revision field */
...@@ -86,8 +91,8 @@ static VLAboutBox *_o_sharedInstance = nil; ...@@ -86,8 +91,8 @@ static VLAboutBox *_o_sharedInstance = nil;
[NSString stringWithFormat: _NS("Compiled by %s, based on SVN revision %s"), [NSString stringWithFormat: _NS("Compiled by %s, based on SVN revision %s"),
VLC_CompileBy(), VLC_Changeset()]]; VLC_CompileBy(), VLC_Changeset()]];
else else
[o_revision_field setStringValue: [NSString stringWithFormat: [o_revision_field setStringValue:
_NS("Compiled by %s"), VLC_CompileBy()]]; [NSString stringWithFormat: _NS("Compiled by %s"), VLC_CompileBy()]];
/* Setup the nameversion field */ /* Setup the nameversion field */
[o_name_version_field setStringValue: [NSString stringWithFormat:@"Version %s (%s)", VLC_Version(), PLATFORM]]; [o_name_version_field setStringValue: [NSString stringWithFormat:@"Version %s (%s)", VLC_Version(), PLATFORM]];
...@@ -99,9 +104,6 @@ static VLAboutBox *_o_sharedInstance = nil; ...@@ -99,9 +104,6 @@ static VLAboutBox *_o_sharedInstance = nil;
[NSString stringWithUTF8String: psz_authors], [NSString stringWithUTF8String: psz_authors],
[NSString stringWithUTF8String: psz_thanks]]]; [NSString stringWithUTF8String: psz_thanks]]];
/* Setup the copyright field */
[o_copyright_field setStringValue: [o_local_dict objectForKey:@"NSHumanReadableCopyright"]];
/* Setup the window */ /* Setup the window */
[o_credits_textview setDrawsBackground: NO]; [o_credits_textview setDrawsBackground: NO];
[o_credits_scrollview setDrawsBackground: NO]; [o_credits_scrollview setDrawsBackground: NO];
...@@ -159,6 +161,12 @@ static VLAboutBox *_o_sharedInstance = nil; ...@@ -159,6 +161,12 @@ static VLAboutBox *_o_sharedInstance = nil;
} }
} }
- (void)VLCWillTerminate
{
[o_scroll_timer invalidate];
[[NSNotificationCenter defaultCenter] removeObserver: self];
}
/***************************************************************************** /*****************************************************************************
* VLC GPL Window, action called from the about window and the help menu * VLC GPL Window, action called from the about window and the help menu
*****************************************************************************/ *****************************************************************************/
...@@ -185,20 +193,19 @@ static VLAboutBox *_o_sharedInstance = nil; ...@@ -185,20 +193,19 @@ static VLAboutBox *_o_sharedInstance = nil;
[o_help_window makeKeyAndOrderFront: self]; [o_help_window makeKeyAndOrderFront: self];
[[o_help_web_view mainFrame] loadHTMLString: [NSString stringWithString: _NS(I_LONGHELP)] [[o_help_web_view mainFrame] loadHTMLString: _NS(I_LONGHELP)
baseURL: [NSURL URLWithString:@"http://videolan.org"]]; baseURL: [NSURL URLWithString:@"http://videolan.org"]];
} }
- (IBAction)helpGoHome:(id)sender - (IBAction)helpGoHome:(id)sender
{ {
/* go home */ [[o_help_web_view mainFrame] loadHTMLString: _NS(I_LONGHELP)
[[o_help_web_view mainFrame] loadHTMLString: [NSString stringWithString: _NS(I_LONGHELP)]
baseURL: [NSURL URLWithString:@"http://videolan.org"]]; baseURL: [NSURL URLWithString:@"http://videolan.org"]];
} }
- (void)webView:(WebView *)sender didFinishLoadForFrame:(WebFrame *)frame - (void)webView:(WebView *)sender didFinishLoadForFrame:(WebFrame *)frame
{ {
/* delegate to update button states (we're the frameLoadDelegate for our help's webview */ /* delegate to update button states (we're the frameLoadDelegate for our help's webview) */
[o_help_fwd_btn setEnabled: [o_help_web_view canGoForward]]; [o_help_fwd_btn setEnabled: [o_help_web_view canGoForward]];
[o_help_bwd_btn setEnabled: [o_help_web_view canGoBack]]; [o_help_bwd_btn setEnabled: [o_help_web_view canGoBack]];
} }
......
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