Fixed a crash selected save after clicking the document close button, and small fixes
This commit is contained in:
1 parent
29e8fe453f
commit
5d7bafae3d
18 files changed
+158
-83
No files matched your search
@@ -398,6 +398,7 @@
|
||||
</tabView>
|
||||
</subviews>
|
||||
<animations/>
|
||||
<point key="canvasLocation" x="532" y="445"/>
|
||||
</customView>
|
||||
</objects>
|
||||
<resources>
|
||||
|
||||
@@ -39,18 +39,18 @@
|
||||
<tabViewItems>
|
||||
<tabViewItem label="Metadata" identifier="1" id="11">
|
||||
<view key="view" id="12">
|
||||
<rect key="frame" x="10" y="29" width="482" height="237"/>
|
||||
<rect key="frame" x="10" y="25" width="482" height="241"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<subviews>
|
||||
<scrollView autohidesScrollers="YES" horizontalLineScroll="16" horizontalPageScroll="10" verticalLineScroll="16" verticalPageScroll="10" usesPredominantAxisScrolling="NO" id="19">
|
||||
<rect key="frame" x="17" y="36" width="448" height="195"/>
|
||||
<rect key="frame" x="17" y="36" width="448" height="199"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<clipView key="contentView" id="Vdx-OM-peX">
|
||||
<rect key="frame" x="1" y="17" width="446" height="177"/>
|
||||
<rect key="frame" x="1" y="0.0" width="446" height="198"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<subviews>
|
||||
<tableView focusRingType="none" verticalHuggingPriority="750" allowsExpansionToolTips="YES" columnAutoresizingStyle="lastColumnOnly" alternatingRowBackgroundColors="YES" columnReordering="NO" columnSelection="YES" autosaveColumns="NO" rowHeight="14" headerView="23" id="22" customClass="SBTableView">
|
||||
<rect key="frame" x="0.0" y="0.0" width="446" height="177"/>
|
||||
<rect key="frame" x="0.0" y="0.0" width="446" height="181"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<animations/>
|
||||
<size key="intercellSpacing" width="3" height="2"/>
|
||||
|
||||
@@ -40,7 +40,6 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
NSDictionary<NSString *, id> *tags;
|
||||
NSArray<NSString *> *_tagsArray;
|
||||
NSArray<NSString *> *tagsMenu;
|
||||
NSDictionary *detailBoldAttr;
|
||||
|
||||
NSMutableDictionary *dct;
|
||||
|
||||
@@ -40,8 +40,8 @@ NSString *MetadataPBoardType = @"SublerMetadataPBoardType";
|
||||
selector:@selector(updateSetsMenu:)
|
||||
name:@"SBPresetManagerUpdatedNotification" object:nil];
|
||||
|
||||
tagsMenu = [[metadata writableMetadata] retain];
|
||||
for (id tag in tagsMenu) {
|
||||
NSArray<NSString *> *tagsMenu = [metadata writableMetadata];
|
||||
for (NSString *tag in tagsMenu) {
|
||||
[tagList addItemWithTitle:tag];
|
||||
}
|
||||
|
||||
@@ -94,13 +94,13 @@ NSString *MetadataPBoardType = @"SublerMetadataPBoardType";
|
||||
[imageBrowser reloadData];
|
||||
}
|
||||
|
||||
- (void) setFile: (MP42File *)file
|
||||
- (void)setFile:(MP42File *)file
|
||||
{
|
||||
metadata = [file.metadata retain];
|
||||
tags = metadata.tagsDict;
|
||||
}
|
||||
|
||||
- (void) setMetadata: (MP42Metadata *)data
|
||||
- (void)setMetadata:(MP42Metadata *)data
|
||||
{
|
||||
metadata = [data retain];
|
||||
tags = data.tagsDict;
|
||||
@@ -820,13 +820,12 @@ objectValueForTableColumn:(NSTableColumn *)tableColumn
|
||||
{
|
||||
[[NSNotificationCenter defaultCenter] removeObserver: self];
|
||||
|
||||
[imageBrowser setDataSource:nil];
|
||||
[imageBrowser setDelegate:nil];
|
||||
[tagsTableView setDataSource:nil];
|
||||
[imageBrowser setDataSource:nil];
|
||||
[tagsTableView setDelegate:nil];
|
||||
[tagsTableView setDataSource:nil];
|
||||
|
||||
[_tagsArray release];
|
||||
[tagsMenu release];
|
||||
[tabCol release];
|
||||
[ratingCell release];
|
||||
[genreCell release];
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/* 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. */
|
||||
//
|
||||
// SBLogger.m
|
||||
// Subler
|
||||
//
|
||||
//
|
||||
|
||||
#import <Cocoa/Cocoa.h>
|
||||
|
||||
|
||||
+8
-12
@@ -1,8 +1,7 @@
|
||||
/* 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. */
|
||||
//
|
||||
// SBLogger.m
|
||||
// Subler
|
||||
//
|
||||
|
||||
#import "SBApplication.h"
|
||||
#import "SBExceptionAlertController.h"
|
||||
@@ -17,14 +16,15 @@ static void CrashMyApplication()
|
||||
- (NSAttributedString *)_formattedExceptionBacktrace:(NSArray *)backtrace
|
||||
{
|
||||
NSMutableAttributedString *result = [[NSMutableAttributedString alloc] init];
|
||||
for (__strong NSString *s in backtrace)
|
||||
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;
|
||||
return [result autorelease];
|
||||
}
|
||||
|
||||
- (void)reportException:(NSException *)exception
|
||||
@@ -37,11 +37,7 @@ static void CrashMyApplication()
|
||||
{
|
||||
// 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];
|
||||
|
||||
|
||||
SBExceptionAlertController *alertController = [[SBExceptionAlertController alloc] init];
|
||||
alertController.exceptionMessage = exceptionMessage;
|
||||
alertController.exceptionBacktrace = [self _formattedExceptionBacktrace:exception.callStackSymbols];
|
||||
|
||||
+22
-19
@@ -133,7 +133,9 @@
|
||||
|
||||
- (BOOL)writeSafelyToURL:(NSURL *)url ofType:(NSString *)typeName forSaveOperation:(NSSaveOperationType)saveOperation error:(NSError * _Nullable *)outError
|
||||
{
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
[self unblockUserInteraction];
|
||||
|
||||
dispatch_sync(dispatch_get_main_queue(), ^{
|
||||
[optBar setIndeterminate:YES];
|
||||
[optBar startAnimation:self];
|
||||
[saveOperationName setStringValue:@"Saving…"];
|
||||
@@ -141,8 +143,6 @@
|
||||
modalDelegate:nil didEndSelector:NULL contextInfo:nil];
|
||||
});
|
||||
|
||||
[self unblockUserInteraction];
|
||||
|
||||
IOPMAssertionID assertionID;
|
||||
// Enable sleep assertion
|
||||
CFStringRef reasonForActivity= CFSTR("Subler Save Operation");
|
||||
@@ -192,18 +192,17 @@
|
||||
IOPMAssertionRelease(assertionID);
|
||||
}
|
||||
|
||||
|
||||
NSError *error = *outError;
|
||||
MP42File *reloadedFile = nil;
|
||||
|
||||
if (result == YES) {
|
||||
reloadedFile = [[[MP42File alloc] initWithURL:url delegate:self] autorelease];
|
||||
reloadedFile = [[MP42File alloc] initWithURL:url delegate:self];
|
||||
}
|
||||
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
[NSApp endSheet:savingWindow];
|
||||
[savingWindow orderOut:self];
|
||||
dispatch_sync(dispatch_get_main_queue(), ^{
|
||||
[optBar stopAnimation:self];
|
||||
[savingWindow orderOut:self];
|
||||
[NSApp endSheet:savingWindow];
|
||||
|
||||
if (result == YES && error) {
|
||||
[self presentError:error
|
||||
@@ -215,6 +214,7 @@
|
||||
|
||||
if (reloadedFile) {
|
||||
self.mp4 = reloadedFile;
|
||||
[reloadedFile release];
|
||||
}
|
||||
|
||||
});
|
||||
@@ -469,15 +469,13 @@ objectValueForTableColumn:(NSTableColumn *)tableColumn
|
||||
|
||||
- (void)reloadPropertyView
|
||||
{
|
||||
if ([propertyView view] != nil) {
|
||||
if (propertyView.view != nil) {
|
||||
// remove the undo items from the dealloced view
|
||||
[[self undoManager] removeAllActionsWithTarget:propertyView];
|
||||
|
||||
// remove the current view
|
||||
[[propertyView view] removeFromSuperview];
|
||||
}
|
||||
[propertyView.view removeFromSuperview];
|
||||
|
||||
// remove the undo items from the dealloced view
|
||||
[[self undoManager] removeAllActionsWithTarget:propertyView];
|
||||
|
||||
if (propertyView != nil) {
|
||||
// remove the current view controller
|
||||
[propertyView release];
|
||||
}
|
||||
@@ -508,7 +506,7 @@ objectValueForTableColumn:(NSTableColumn *)tableColumn
|
||||
propertyView = controller;
|
||||
|
||||
// embed the current view to our host view
|
||||
[targetView addSubview: [propertyView view]];
|
||||
[targetView addSubview:propertyView.view];
|
||||
[documentWindow recalculateKeyViewLoop];
|
||||
|
||||
// make sure we automatically resize the controller's view to the current window size
|
||||
@@ -519,8 +517,9 @@ objectValueForTableColumn:(NSTableColumn *)tableColumn
|
||||
- (BOOL)tableView:(NSTableView *)tv writeRowsWithIndexes:(NSIndexSet *)rowIndexes toPasteboard:(NSPasteboard *)pboard
|
||||
{
|
||||
// Copy the row numbers to the pasteboard.
|
||||
if ([[self.mp4 trackAtIndex:[rowIndexes firstIndex]] muxed])
|
||||
if ([[self.mp4 trackAtIndex:[rowIndexes firstIndex]] muxed]) {
|
||||
return NO;
|
||||
}
|
||||
|
||||
NSData *data = [NSKeyedArchiver archivedDataWithRootObject:rowIndexes];
|
||||
[pboard declareTypes:@[SublerTableViewDataType] owner:self];
|
||||
@@ -652,8 +651,9 @@ objectValueForTableColumn:(NSTableColumn *)tableColumn
|
||||
MP42VideoTrack *videoTrack = (MP42VideoTrack *)track;
|
||||
int hdVideo = isHdVideo((uint64_t)videoTrack.trackWidth, (uint64_t)videoTrack.trackHeight);
|
||||
|
||||
if (hdVideo)
|
||||
[self.mp4.metadata setTag:@(hdVideo) forKey:@"HD Video"];
|
||||
if (hdVideo) {
|
||||
self.mp4.metadata[@"HD Video"] = @(hdVideo);
|
||||
}
|
||||
}
|
||||
[self updateChangeCount:NSChangeDone];
|
||||
}
|
||||
@@ -955,6 +955,9 @@ objectValueForTableColumn:(NSTableColumn *)tableColumn
|
||||
|
||||
- (void)dealloc
|
||||
{
|
||||
[fileTracksTable setDelegate:nil];
|
||||
[fileTracksTable setDataSource:nil];
|
||||
|
||||
[propertyView release];
|
||||
propertyView = nil;
|
||||
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
/* 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. */
|
||||
//
|
||||
// SBLogger.m
|
||||
// Subler
|
||||
//
|
||||
|
||||
#import <Cocoa/Cocoa.h>
|
||||
|
||||
@@ -11,11 +10,14 @@ typedef NS_ENUM(NSUInteger, SBExceptionAlertControllerResult) {
|
||||
SBExceptionAlertControllerResultContinue,
|
||||
};
|
||||
|
||||
@interface SBExceptionAlertController : NSWindowController
|
||||
@interface SBExceptionAlertController : NSWindowController {
|
||||
NSString *_exceptionMessage;
|
||||
NSAttributedString *_exceptionBacktrace;
|
||||
}
|
||||
|
||||
// Properties are used by bindings
|
||||
@property (copy) NSString *exceptionMessage;
|
||||
@property (copy) NSAttributedString *exceptionBacktrace;
|
||||
@property (nonatomic, copy) NSString *exceptionMessage;
|
||||
@property (nonatomic, copy) NSAttributedString *exceptionBacktrace;
|
||||
|
||||
- (IBAction)btnCrashClicked:(id)sender;
|
||||
- (IBAction)btnContinueClicked:(id)sender;
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
/* 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. */
|
||||
//
|
||||
// SBLogger.m
|
||||
// Subler
|
||||
//
|
||||
|
||||
#import "SBExceptionAlertController.h"
|
||||
|
||||
@@ -13,6 +12,9 @@
|
||||
return [self initWithWindowNibName:@"ExceptionAlert"];
|
||||
}
|
||||
|
||||
@synthesize exceptionBacktrace = _exceptionBacktrace;
|
||||
@synthesize exceptionMessage = _exceptionMessage;
|
||||
|
||||
- (NSInteger)runModal
|
||||
{
|
||||
return [NSApp runModalForWindow:self.window];
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
{
|
||||
self = [super initWithFrame:frame];
|
||||
if (self) {
|
||||
_pasteboardTypes = @[];
|
||||
_pasteboardTypes = [@[] retain];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
@@ -25,7 +25,7 @@
|
||||
{
|
||||
self = [super initWithCoder:coder];
|
||||
if (self) {
|
||||
_pasteboardTypes = @[];
|
||||
_pasteboardTypes = [@[] retain];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
@@ -62,6 +62,8 @@
|
||||
- (void)dealloc
|
||||
{
|
||||
[_pasteboardTypes release];
|
||||
_pasteboardTypes = nil;
|
||||
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
|
||||
@@ -14,6 +14,7 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
@class SBLogger;
|
||||
|
||||
@interface SBLogWindowController : NSWindowController <MP42Logging> {
|
||||
@private
|
||||
NSTextView *_logView;
|
||||
SBLogger *_logger;
|
||||
}
|
||||
|
||||
@@ -420,10 +420,10 @@
|
||||
}
|
||||
[delegate metadataImportDone:self.selectedResult];
|
||||
|
||||
[metadataTable setDataSource:nil];
|
||||
[metadataTable setDelegate:nil];
|
||||
[resultsTable setDataSource:nil];
|
||||
[metadataTable setDataSource:nil];
|
||||
[resultsTable setDelegate:nil];
|
||||
[resultsTable setDataSource:nil];
|
||||
|
||||
[NSApp endSheet:[self window] returnCode:1];
|
||||
}
|
||||
@@ -433,10 +433,10 @@
|
||||
[self.currentSearcher cancel];
|
||||
self.currentSearcher = nil;
|
||||
|
||||
[metadataTable setDataSource:nil];
|
||||
[metadataTable setDelegate:nil];
|
||||
[resultsTable setDataSource:nil];
|
||||
[metadataTable setDataSource:nil];
|
||||
[resultsTable setDelegate:nil];
|
||||
[resultsTable setDataSource:nil];
|
||||
|
||||
[NSApp endSheet:[self window] returnCode:0];
|
||||
}
|
||||
@@ -593,10 +593,12 @@ static NSInteger sortFunction (id ldict, id rdict, void *context) {
|
||||
NSInteger right = [(NSArray*) context indexOfObject:rdict];
|
||||
NSInteger left = [(NSArray*) context indexOfObject:ldict];
|
||||
|
||||
if (right < left)
|
||||
if (right < left) {
|
||||
rc = NSOrderedDescending;
|
||||
else
|
||||
}
|
||||
else {
|
||||
rc = NSOrderedAscending;
|
||||
}
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
@@ -167,8 +167,9 @@
|
||||
|
||||
MP42Image *artwork = [self loadArtwork:artworkURL];
|
||||
|
||||
if (artwork)
|
||||
if (artwork) {
|
||||
[metadata.artworks addObject:artwork];
|
||||
}
|
||||
}
|
||||
|
||||
return metadata;
|
||||
@@ -183,11 +184,12 @@
|
||||
MP42VideoTrack *videoTrack = (MP42VideoTrack *)track;
|
||||
int hdVideo = isHdVideo((uint64_t)videoTrack.trackWidth, (uint64_t)videoTrack.trackHeight);
|
||||
|
||||
if (hdVideo)
|
||||
[metadata setTag:@(hdVideo) forKey:@"HD Video"];
|
||||
if (hdVideo) {
|
||||
metadata[@"HD Video"] = @(hdVideo);
|
||||
}
|
||||
}
|
||||
|
||||
[[item.mp4File metadata] mergeMetadata:metadata];
|
||||
[item.mp4File.metadata mergeMetadata:metadata];
|
||||
}
|
||||
|
||||
- (NSString *)description {
|
||||
|
||||
@@ -26,7 +26,7 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
NSArray<NSString *> *_pasteboardTypes;
|
||||
NSInteger _defaultEditingColumn;
|
||||
}
|
||||
@property(nonatomic, readwrite, retain) NSArray<NSString *> *pasteboardTypes;
|
||||
@property(nonatomic, readwrite, copy) NSArray<NSString *> *pasteboardTypes;
|
||||
@property(nonatomic, readwrite) NSInteger defaultEditingColumn;
|
||||
@end
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
{
|
||||
self = [super initWithFrame:frame];
|
||||
if (self) {
|
||||
_pasteboardTypes = @[];
|
||||
_pasteboardTypes = [@[] retain];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
@@ -27,7 +27,7 @@
|
||||
{
|
||||
self = [super initWithCoder:coder];
|
||||
if (self) {
|
||||
_pasteboardTypes = @[];
|
||||
_pasteboardTypes = [@[] retain];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
@@ -170,9 +170,11 @@
|
||||
[super drawRow:inRow clipRect:newClipRect];
|
||||
}
|
||||
|
||||
- (void) dealloc
|
||||
- (void)dealloc
|
||||
{
|
||||
[_pasteboardTypes release];
|
||||
_pasteboardTypes = nil;
|
||||
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user