summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorritsuka <[email protected]>2008-07-23 18:51:31 +0000
committerritsuka <[email protected]>2008-07-23 18:51:31 +0000
commit127de2ab5779a0aabb51b511a5814ccf7c480b70 (patch)
tree8f334c692b58618f1d49c36d0e49399c920d76e1
parent2f0bd381d554277f4fe77b915dccd0e6f77a3512 (diff)
MacGui; Fixed a crash when the chapters tableview is selected and a new source is being opened.
Some whitespace cleaning too. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@1574 b64f7644-9d1e-0410-96f1-a4d463321fa5
-rw-r--r--macosx/ChapterTitles.m34
-rw-r--r--macosx/Controller.mm33
2 files changed, 33 insertions, 34 deletions
diff --git a/macosx/ChapterTitles.m b/macosx/ChapterTitles.m
index cc2d50c23..e957d3ee2 100644
--- a/macosx/ChapterTitles.m
+++ b/macosx/ChapterTitles.m
@@ -65,12 +65,15 @@
{
if(aTableColumn != nil && [[aTableColumn identifier] intValue] == 2)
{
- hb_chapter_t *chapter = hb_list_item( fTitle->list_chapter, rowIndex );
-
- if( chapter != NULL )
+ if( fTitle )
{
- strncpy( chapter->title, [anObject UTF8String], 1023);
- chapter->title[1023] = '\0';
+ hb_chapter_t *chapter = hb_list_item( fTitle->list_chapter, rowIndex );
+
+ if( chapter != NULL )
+ {
+ strncpy( chapter->title, [anObject UTF8String], 1023);
+ chapter->title[1023] = '\0';
+ }
}
}
}
@@ -87,18 +90,21 @@
}
else
{
- hb_chapter_t *chapter = hb_list_item( fTitle->list_chapter, rowIndex );
-
- if( chapter != NULL )
+ if( fTitle )
{
- cellEntry = [NSString stringWithUTF8String:chapter->title];
- }
- else
- {
- cellEntry = @"__DATA ERROR__";
+ hb_chapter_t *chapter = hb_list_item( fTitle->list_chapter, rowIndex );
+
+ if( chapter != NULL )
+ {
+ cellEntry = [NSString stringWithUTF8String:chapter->title];
+ }
+ else
+ {
+ cellEntry = @"__DATA ERROR__";
+ }
}
}
-
+
return cellEntry;
}
diff --git a/macosx/Controller.mm b/macosx/Controller.mm
index 0143763e0..abef9b6f3 100644
--- a/macosx/Controller.mm
+++ b/macosx/Controller.mm
@@ -1182,9 +1182,7 @@ static NSString * ChooseSourceIdentifier = @"Choose Source It
{
[NSApp endSheet: fScanSrcTitlePanel];
[fScanSrcTitlePanel orderOut: self];
-
-
-
+
if(sender == fScanSrcTitleOpenButton)
{
/* We setup the scan status in the main window to indicate a source title scan */
@@ -1200,7 +1198,6 @@ static NSString * ChooseSourceIdentifier = @"Choose Source It
}
}
-
/* Here we actually tell hb_scan to perform the source scan, using the path to source and title number*/
- (void) performScan:(NSString *) scanPath scanTitleNum: (int) scanTitleNum
{
@@ -1208,13 +1205,18 @@ static NSString * ChooseSourceIdentifier = @"Choose Source It
BOOL cancelScanDecrypt = 0;
NSString *path = scanPath;
HBDVDDetector *detector = [HBDVDDetector detectorForPath:path];
+
+ // Notify ChapterTitles that there's no title
+ [fChapterTitlesDelegate resetWithTitle:nil];
+ [fChapterTable reloadData];
+
if( [detector isVideoDVD] )
{
// The chosen path was actually on a DVD, so use the raw block
// device path instead.
path = [detector devicePath];
[self writeToActivityLog: "trying to open a physical dvd at: %s", [scanPath UTF8String]];
-
+
/* lets check for vlc here to make sure we have a dylib available to use for decrypting */
NSString *vlcPath = @"/Applications/VLC.app";
NSFileManager * fileManager = [NSFileManager defaultManager];
@@ -1243,21 +1245,17 @@ static NSString * ChooseSourceIdentifier = @"Choose Source It
cancelScanDecrypt = 0;
[self writeToActivityLog: "user overrode vlc warning -trying to open physical dvd without decryption"];
}
-
+
}
else
{
/* VLC was found in /Applications so all is well, we can carry on using vlc's libdvdcss.dylib for decrypting if needed */
[self writeToActivityLog: "VLC app found for decrypting physical dvd"];
}
-
}
-
-
-
+
if (cancelScanDecrypt == 0)
{
-
/* we actually pass the scan off to libhb here */
/* If there is no title number passed to scan, we use "0"
* which causes the default behavior of a full source scan
@@ -1270,6 +1268,7 @@ static NSString * ChooseSourceIdentifier = @"Choose Source It
{
[self writeToActivityLog: "scanning specifically for title: %d", scanTitleNum];
}
+
hb_scan( fHandle, [path UTF8String], scanTitleNum );
[fSrcDVD2Field setStringValue:@"Scanning new source ..."];
}
@@ -1281,8 +1280,6 @@ static NSString * ChooseSourceIdentifier = @"Choose Source It
[self enableUI: YES];
}
}
-
-
}
- (IBAction) showNewScan:(id)sender
@@ -1291,15 +1288,15 @@ static NSString * ChooseSourceIdentifier = @"Choose Source It
hb_title_t * title;
int indxpri=0; // Used to search the longuest title (default in combobox)
int longuestpri=0; // Used to search the longuest title (default in combobox)
-
+
list = hb_get_titles( fHandle );
-
+
if( !hb_list_count( list ) )
{
/* We display a message if a valid dvd source was not chosen */
[fSrcDVD2Field setStringValue: @"No Valid Source Found"];
SuccessfulScan = NO;
-
+
// Notify ChapterTitles that there's no title
[fChapterTitlesDelegate resetWithTitle:nil];
[fChapterTable reloadData];
@@ -2090,10 +2087,6 @@ static NSString * ChooseSourceIdentifier = @"Choose Source It
[self doCancelCurrentJob]; // <- this also stops libhb
}
-
-
-
-
- (IBAction) Pause: (id) sender
{
hb_state_t s;