--- /dev/null
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="7706" systemVersion="14E17e" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none">
+ <dependencies>
+ <deployment identifier="macosx"/>
+ <development version="6100" identifier="xcode"/>
+ <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="7706"/>
+ </dependencies>
+ <objects>
+ <customObject id="-2" userLabel="File's Owner" customClass="MyExceptionAlertController">
+ <connections>
+ <outlet property="window" destination="1" id="17"/>
+ </connections>
+ </customObject>
+ <customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
+ <customObject id="-3" userLabel="Application" customClass="NSObject"/>
+ <window title="Internal Error" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" oneShot="NO" animationBehavior="default" id="1">
+ <windowStyleMask key="styleMask" titled="YES" closable="YES" miniaturizable="YES" resizable="YES"/>
+ <rect key="contentRect" x="196" y="127" width="636" height="383"/>
+ <rect key="screenRect" x="0.0" y="0.0" width="2560" height="1417"/>
+ <value key="minSize" type="size" width="636" height="383"/>
+ <view key="contentView" id="2">
+ <rect key="frame" x="0.0" y="0.0" width="636" height="383"/>
+ <autoresizingMask key="autoresizingMask"/>
+ <subviews>
+ <imageView id="3">
+ <rect key="frame" x="20" y="302" width="70" height="61"/>
+ <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
+ <imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageScaling="proportionallyDown" image="NSApplicationIcon" id="4"/>
+ </imageView>
+ <textField verticalHuggingPriority="750" id="9">
+ <rect key="frame" x="95" y="323" width="524" height="40"/>
+ <autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMinY="YES"/>
+ <textFieldCell key="cell" sendsActionOnEndEditing="YES" title="An internal error has occurred. You can choose to continue in an unstable state, or crash." id="10">
+ <font key="font" metaFont="systemBold"/>
+ <color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
+ <color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
+ </textFieldCell>
+ </textField>
+ <textField verticalHuggingPriority="750" id="11">
+ <rect key="frame" x="95" y="282" width="339" height="41"/>
+ <autoresizingMask key="autoresizingMask" flexibleMinY="YES"/>
+ <textFieldCell key="cell" sendsActionOnEndEditing="YES" title="Reason contents go here." id="12">
+ <font key="font" metaFont="smallSystem"/>
+ <color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
+ <color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
+ </textFieldCell>
+ <connections>
+ <binding destination="-2" name="value" keyPath="exceptionMessage" id="27">
+ <dictionary key="options">
+ <bool key="NSAllowsEditingMultipleValuesSelection" value="NO"/>
+ </dictionary>
+ </binding>
+ </connections>
+ </textField>
+ <button verticalHuggingPriority="750" id="13">
+ <rect key="frame" x="418" y="12" width="96" height="32"/>
+ <autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMaxY="YES"/>
+ <buttonCell key="cell" type="push" title="Crash" bezelStyle="rounded" alignment="center" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="14">
+ <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
+ <font key="font" metaFont="system"/>
+ <string key="keyEquivalent" base64-UTF8="YES">
+Gw
+</string>
+ </buttonCell>
+ <connections>
+ <action selector="btnCrashClicked:" target="-2" id="24"/>
+ </connections>
+ </button>
+ <button verticalHuggingPriority="750" id="15">
+ <rect key="frame" x="526" y="12" width="97" height="32"/>
+ <autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMaxY="YES"/>
+ <buttonCell key="cell" type="push" title="Continue" bezelStyle="rounded" alignment="center" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="16">
+ <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
+ <font key="font" metaFont="system"/>
+ <string key="keyEquivalent" base64-UTF8="YES">
+DQ
+</string>
+ </buttonCell>
+ <connections>
+ <action selector="btnContinueClicked:" target="-2" id="23"/>
+ </connections>
+ </button>
+ <scrollView horizontalLineScroll="10" horizontalPageScroll="10" verticalLineScroll="10" verticalPageScroll="10" hasHorizontalScroller="NO" usesPredominantAxisScrolling="NO" id="19">
+ <rect key="frame" x="20" y="60" width="596" height="206"/>
+ <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
+ <clipView key="contentView" id="RBQ-rK-0Rs">
+ <rect key="frame" x="1" y="1" width="594" height="204"/>
+ <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
+ <subviews>
+ <textView importsGraphics="NO" findStyle="panel" continuousSpellChecking="YES" allowsUndo="YES" usesRuler="YES" usesFontPanel="YES" verticallyResizable="YES" allowsNonContiguousLayout="YES" spellingCorrection="YES" smartInsertDelete="YES" id="22">
+ <rect key="frame" x="0.0" y="0.0" width="594" height="204"/>
+ <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
+ <color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
+ <size key="minSize" width="594" height="204"/>
+ <size key="maxSize" width="759" height="10000000"/>
+ <color key="insertionPointColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
+ <size key="minSize" width="594" height="204"/>
+ <size key="maxSize" width="759" height="10000000"/>
+ <connections>
+ <binding destination="-2" name="attributedString" keyPath="exceptionBacktrace" id="28"/>
+ </connections>
+ </textView>
+ </subviews>
+ <color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
+ </clipView>
+ <scroller key="horizontalScroller" hidden="YES" verticalHuggingPriority="750" doubleValue="1" horizontal="YES" id="21">
+ <rect key="frame" x="-100" y="-100" width="87" height="18"/>
+ <autoresizingMask key="autoresizingMask"/>
+ </scroller>
+ <scroller key="verticalScroller" verticalHuggingPriority="750" doubleValue="1" horizontal="NO" id="20">
+ <rect key="frame" x="579" y="1" width="16" height="204"/>
+ <autoresizingMask key="autoresizingMask"/>
+ </scroller>
+ </scrollView>
+ </subviews>
+ </view>
+ <connections>
+ <outlet property="initialFirstResponder" destination="13" id="29"/>
+ </connections>
+ <point key="canvasLocation" x="256" y="550.5"/>
+ </window>
+ </objects>
+ <resources>
+ <image name="NSApplicationIcon" width="128" height="128"/>
+ </resources>
+</document>
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="6250" systemVersion="14B23" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none">
+<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="7706" systemVersion="14E17e" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none">
<dependencies>
<deployment version="1060" identifier="macosx"/>
<development version="5100" identifier="xcode"/>
- <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="6250"/>
+ <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="7706"/>
</dependencies>
<objects>
- <customObject id="-2" userLabel="File's Owner" customClass="NSApplication">
+ <customObject id="-2" userLabel="File's Owner" customClass="HBApplication">
<connections>
<outlet property="delegate" destination="240" id="247"/>
</connections>
--- /dev/null
+/* HBApplication.h $
+
+ This file is part of the HandBrake source code.
+ Homepage: <http://handbrake.fr/>.
+ It may be used under the terms of the GNU General Public License. */
+
+#import <Cocoa/Cocoa.h>
+
+@interface HBApplication : NSApplication
+
+@end
--- /dev/null
+/* HBApplication.m $
+
+ This file is part of the HandBrake source code.
+ Homepage: <http://handbrake.fr/>.
+ It may be used under the terms of the GNU General Public License. */
+
+#import "HBApplication.h"
+#import "HBExceptionAlertController.h"
+#import "HBUtilities.h"
+
+@implementation HBApplication
+
+static void CrashMyApplication()
+{
+ *(char *)0x08 = 1;
+}
+
+- (NSAttributedString *)_formattedExceptionBacktrace:(NSArray *)backtrace
+{
+ NSMutableAttributedString *result = [[NSMutableAttributedString alloc] init];
+ for (NSString *s in backtrace)
+ {
+ s = [s stringByAppendingString:@"\n"];
+ NSAttributedString *attrS = [[NSAttributedString alloc] initWithString:s];
+ [result appendAttributedString:attrS];
+ [attrS release];
+ }
+ [result addAttribute:NSFontAttributeName value:[NSFont fontWithName:@"Monaco" size:10] range:NSMakeRange(0, result.length)];
+ return [result autorelease];
+}
+
+- (void)reportException:(NSException *)exception
+{
+ // NSApplication simply logs the exception to the console. We want to let the user know
+ // when it happens in order to possibly prevent subsequent random crashes that are difficult to debug
+ @try
+ {
+ @autoreleasepool
+ {
+ // Create a string based on the exception
+ NSString *exceptionMessage = [NSString stringWithFormat:@"%@\nReason: %@\nUser Info: %@", exception.name, exception.reason, exception.userInfo];
+ // Always log to console for history
+
+ [HBUtilities writeToActivityLog:"Exception raised:\n%s", exceptionMessage.UTF8String];
+ [HBUtilities writeToActivityLog:"Backtrace:\n%s", exception.callStackSymbols.description.UTF8String];
+
+ HBExceptionAlertController *alertController = [[HBExceptionAlertController alloc] init];
+ alertController.exceptionMessage = exceptionMessage;
+ alertController.exceptionBacktrace = [self _formattedExceptionBacktrace:exception.callStackSymbols];
+
+ NSInteger result = [alertController runModal];
+ if (result == HBExceptionAlertControllerResultCrash)
+ {
+ CrashMyApplication();
+ }
+ }
+ }
+ @catch (NSException *e)
+ {
+ // Suppress any exceptions raised in the handling
+ }
+}
+
+@end
--- /dev/null
+/* HBExceptionAlertController.h $
+
+ This file is part of the HandBrake source code.
+ Homepage: <http://handbrake.fr/>.
+ It may be used under the terms of the GNU General Public License. */
+
+#import <Cocoa/Cocoa.h>
+
+typedef NS_ENUM(NSUInteger, HBExceptionAlertControllerResult) {
+ HBExceptionAlertControllerResultCrash,
+ HBExceptionAlertControllerResultContinue,
+};
+
+@interface HBExceptionAlertController : NSWindowController
+
+// Properties are used by bindings
+@property (copy) NSString *exceptionMessage;
+@property (copy) NSAttributedString *exceptionBacktrace;
+
+- (IBAction)btnCrashClicked:(id)sender;
+- (IBAction)btnContinueClicked:(id)sender;
+
+- (NSInteger)runModal;
+
+@end
--- /dev/null
+/* HBExceptionAlertController.m $
+
+ This file is part of the HandBrake source code.
+ Homepage: <http://handbrake.fr/>.
+ It may be used under the terms of the GNU General Public License. */
+
+#import "HBExceptionAlertController.h"
+
+@implementation HBExceptionAlertController
+
+- (instancetype)init
+{
+ return [self initWithWindowNibName:@"ExceptionAlert"];
+}
+
+- (NSInteger)runModal
+{
+ return [NSApp runModalForWindow:self.window];
+}
+
+- (IBAction)btnCrashClicked:(id)sender
+{
+ [self.window orderOut:nil];
+ [NSApp stopModalWithCode:HBExceptionAlertControllerResultCrash];
+}
+
+- (IBAction)btnContinueClicked:(id)sender
+{
+ [self.window orderOut:nil];
+ [NSApp stopModalWithCode:HBExceptionAlertControllerResultContinue];
+}
+
+@end
A9E1468116BC2AD800C307BC /* pause-p.pdf in Resources */ = {isa = PBXBuildFile; fileRef = A9E1467D16BC2AD800C307BC /* pause-p.pdf */; };
A9E1468216BC2AD800C307BC /* play-p.pdf in Resources */ = {isa = PBXBuildFile; fileRef = A9E1467E16BC2AD800C307BC /* play-p.pdf */; };
A9E1468316BC2AD800C307BC /* prev-p.pdf in Resources */ = {isa = PBXBuildFile; fileRef = A9E1467F16BC2AD800C307BC /* prev-p.pdf */; };
+ A9F10FE01B131DA5004A9895 /* ExceptionAlert.xib in Resources */ = {isa = PBXBuildFile; fileRef = A9F10FDE1B131DA5004A9895 /* ExceptionAlert.xib */; };
+ A9F10FE31B131DBA004A9895 /* HBApplication.m in Sources */ = {isa = PBXBuildFile; fileRef = A9F10FE21B131DBA004A9895 /* HBApplication.m */; };
+ A9F10FE61B131DD8004A9895 /* HBExceptionAlertController.m in Sources */ = {isa = PBXBuildFile; fileRef = A9F10FE51B131DD8004A9895 /* HBExceptionAlertController.m */; };
A9F2EB6F196F12C800066546 /* Audio.xib in Resources */ = {isa = PBXBuildFile; fileRef = A9F2EB6D196F12C800066546 /* Audio.xib */; };
A9F472891976B7F30009EC65 /* HBSubtitlesDefaultsController.m in Sources */ = {isa = PBXBuildFile; fileRef = A9F472871976B7F30009EC65 /* HBSubtitlesDefaultsController.m */; };
A9F4728D1976BAA70009EC65 /* HBSubtitlesDefaults.m in Sources */ = {isa = PBXBuildFile; fileRef = A9F4728C1976BAA70009EC65 /* HBSubtitlesDefaults.m */; };
A9E1467D16BC2AD800C307BC /* pause-p.pdf */ = {isa = PBXFileReference; lastKnownFileType = image.pdf; path = "pause-p.pdf"; sourceTree = "<group>"; };
A9E1467E16BC2AD800C307BC /* play-p.pdf */ = {isa = PBXFileReference; lastKnownFileType = image.pdf; path = "play-p.pdf"; sourceTree = "<group>"; };
A9E1467F16BC2AD800C307BC /* prev-p.pdf */ = {isa = PBXFileReference; lastKnownFileType = image.pdf; path = "prev-p.pdf"; sourceTree = "<group>"; };
+ A9F10FDF1B131DA5004A9895 /* English */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = English; path = ExceptionAlert.xib; sourceTree = "<group>"; };
+ A9F10FE11B131DBA004A9895 /* HBApplication.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HBApplication.h; sourceTree = "<group>"; };
+ A9F10FE21B131DBA004A9895 /* HBApplication.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HBApplication.m; sourceTree = "<group>"; };
+ A9F10FE41B131DD8004A9895 /* HBExceptionAlertController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HBExceptionAlertController.h; sourceTree = "<group>"; };
+ A9F10FE51B131DD8004A9895 /* HBExceptionAlertController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HBExceptionAlertController.m; sourceTree = "<group>"; };
A9F2EB6E196F12C800066546 /* English */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = English; path = Audio.xib; sourceTree = "<group>"; };
A9F472861976B7F30009EC65 /* HBSubtitlesDefaultsController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HBSubtitlesDefaultsController.h; sourceTree = "<group>"; };
A9F472871976B7F30009EC65 /* HBSubtitlesDefaultsController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HBSubtitlesDefaultsController.m; sourceTree = "<group>"; };
273F209E14ADBE670021BE6D /* HBOutputRedirect.m */,
A98C29C21977B10600AF5DED /* HBLanguagesSelection.h */,
A98C29C31977B10600AF5DED /* HBLanguagesSelection.m */,
+ A9F10FE11B131DBA004A9895 /* HBApplication.h */,
+ A9F10FE21B131DBA004A9895 /* HBApplication.m */,
+ A9F10FE41B131DD8004A9895 /* HBExceptionAlertController.h */,
+ A9F10FE51B131DD8004A9895 /* HBExceptionAlertController.m */,
A9B34D711976844500871B7D /* UI Views */,
273F20BD14ADC09F0021BE6D /* main.mm */,
);
children = (
273F217C14ADDDA10021BE6D /* InfoPlist.strings */,
273F217E14ADDDA10021BE6D /* MainMenu.xib */,
+ A9F10FDE1B131DA5004A9895 /* ExceptionAlert.xib */,
A9CF25EF1990D62C0023F727 /* Presets.xib */,
A93E0ED51972958C00FD67FB /* Video.xib */,
A9F2EB6D196F12C800066546 /* Audio.xib */,
A9252C0C1A173D4800B8B7F8 /* RevealPressed@2x.png in Resources */,
A9204DC71A16C5AB007CA74C /* DeletePressed@2x.png in Resources */,
D2BCB11816F5152C0084604C /* presets@2x.png in Resources */,
+ A9F10FE01B131DA5004A9895 /* ExceptionAlert.xib in Resources */,
A91C025F1A166BE300DEA6F3 /* EncodeWorking5@2x.png in Resources */,
A91C025C1A166BE300DEA6F3 /* EncodeWorking2@2x.png in Resources */,
A91C024D1A16516A00DEA6F3 /* JobSmall@2x.png in Resources */,
files = (
A9F7102619A475EC00F61301 /* HBDockTile.m in Sources */,
A98C29C41977B10600AF5DED /* HBLanguagesSelection.m in Sources */,
+ A9F10FE61B131DD8004A9895 /* HBExceptionAlertController.m in Sources */,
+ A9F10FE31B131DBA004A9895 /* HBApplication.m in Sources */,
A9BB0F2719A0ECE40079F1C1 /* HBHUDButtonCell.m in Sources */,
A932E273198834130047D13E /* HBAudioDefaults.m in Sources */,
A9523937199A6AAE00588AEF /* HBFilters.m in Sources */,
name = Subtitles.xib;
sourceTree = "<group>";
};
+ A9F10FDE1B131DA5004A9895 /* ExceptionAlert.xib */ = {
+ isa = PBXVariantGroup;
+ children = (
+ A9F10FDF1B131DA5004A9895 /* English */,
+ );
+ name = ExceptionAlert.xib;
+ sourceTree = "<group>";
+ };
A9F2EB6D196F12C800066546 /* Audio.xib */ = {
isa = PBXVariantGroup;
children = (
</TestAction>
<LaunchAction
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
- selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.GDB"
+ selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
buildConfiguration = "release"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
allowLocationSimulation = "YES">
- <BuildableProductRunnable>
+ <BuildableProductRunnable
+ runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "273F203814ADBC200021BE6D"
useCustomWorkingDirectory = "NO"
buildConfiguration = "release"
debugDocumentVersioning = "YES">
- <BuildableProductRunnable>
+ <BuildableProductRunnable
+ runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "273F203814ADBC200021BE6D"
<key>NSMainNibFile</key>
<string>MainMenu</string>
<key>NSPrincipalClass</key>
- <string>NSApplication</string>
+ <string>HBApplication</string>
<key>SUFeedURL</key>
<string>__HB_url_appcast</string>
</dict>