From cf982f896f80ed72e3c046dee0af49d1a1f4c9e6 Mon Sep 17 00:00:00 2001 From: dynaflash Date: Thu, 5 Aug 2010 16:45:00 +0000 Subject: MacGui: Disable preview hud controls during new source scans. - Fixes a crash where trying to get a preview image when a new source is being loaded will cause a crash - Mirrors enableUI in the main window. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@3471 b64f7644-9d1e-0410-96f1-a4d463321fa5 --- macosx/Controller.m | 14 +++++++++----- macosx/HBPreviewController.h | 3 +++ macosx/HBPreviewController.m | 22 ++++++++++++++++++++++ macosx/PictureController.h | 2 ++ macosx/PictureController.m | 8 ++++++++ 5 files changed, 44 insertions(+), 5 deletions(-) diff --git a/macosx/Controller.m b/macosx/Controller.m index 5bba38c54..86674adea 100644 --- a/macosx/Controller.m +++ b/macosx/Controller.m @@ -594,19 +594,23 @@ static NSString * ChooseSourceIdentifier = @"Choose Source It } - if (b) { + if (b) + { /* if we're enabling the interface, check if the audio mixdown controls need to be enabled or not */ /* these will have been enabled by the mass control enablement above anyway, so we're sense-checking it here */ [self setEnabledStateOfAudioMixdownControls:nil]; /* we also call calculatePictureSizing here to sense check if we already have vfr selected */ [self calculatePictureSizing:nil]; - - } else { + /* Also enable the preview window hud controls */ + [fPictureController enablePreviewHudControls]; + } + else + { [fPresetsOutlineView setEnabled: NO]; - - } + [fPictureController disablePreviewHudControls]; + } [self videoMatrixChanged:nil]; [fAdvancedOptions enableUI:b]; diff --git a/macosx/HBPreviewController.h b/macosx/HBPreviewController.h index 3d26e6927..1394a9730 100644 --- a/macosx/HBPreviewController.h +++ b/macosx/HBPreviewController.h @@ -97,6 +97,9 @@ - (IBAction)goWindowedScreen:(id)sender; /* HUD overlay */ +- (void) enableHudControls; +- (void) disableHudControls; + - (void) startHudTimer; - (void) stopHudTimer; diff --git a/macosx/HBPreviewController.m b/macosx/HBPreviewController.m index 10b239d5d..7fa8a8449 100644 --- a/macosx/HBPreviewController.m +++ b/macosx/HBPreviewController.m @@ -487,6 +487,28 @@ } #pragma mark Hud Control Overlay +/* enableHudControls and disableHudControls are used to sync enableUI + * in HBController so that during a scan we do not attempt to access source + * images, etc. which can cause a crash. In general this ui behavior will mirror + * the main window ui's enableUI method and in fact is called from there */ +- (void) enableHudControls +{ + [fPictureSlider setEnabled:YES]; + [fScaleToScreenToggleButton setEnabled:YES]; + [fCreatePreviewMovieButton setEnabled:YES]; + [fGoToStillPreviewButton setEnabled:YES]; + [fHBController writeToActivityLog: "Preview: Enabling HUD Controls"]; +} + +- (void) disableHudControls +{ + [fPictureSlider setEnabled:NO]; + [fScaleToScreenToggleButton setEnabled:NO]; + [fCreatePreviewMovieButton setEnabled:NO]; + [fGoToStillPreviewButton setEnabled:NO]; + [fHBController writeToActivityLog: "Preview: Disabling HUD Controls"]; +} + - (void) mouseMoved:(NSEvent *)theEvent { [super mouseMoved:theEvent]; diff --git a/macosx/PictureController.h b/macosx/PictureController.h index 96ea118ae..56dbe5f21 100644 --- a/macosx/PictureController.h +++ b/macosx/PictureController.h @@ -170,6 +170,8 @@ - (IBAction) resizeInspectorForTab: (id)sender; - (IBAction) showPreviewWindow: (id)sender; +- (void) enablePreviewHudControls; +- (void) disablePreviewHudControls; - (IBAction) adjustSizingDisplay: (id) sender; diff --git a/macosx/PictureController.m b/macosx/PictureController.m index 4cc39331f..78174102e 100644 --- a/macosx/PictureController.m +++ b/macosx/PictureController.m @@ -395,7 +395,15 @@ [fPreviewController showWindow:sender]; } +- (void) enablePreviewHudControls +{ + [fPreviewController enableHudControls]; +} +- (void) disablePreviewHudControls +{ + [fPreviewController disableHudControls]; +} - (void) setToWindowedMode { -- cgit v1.2.3