fixed crash problem

This commit is contained in:
Jeena Paradies 2012-07-26 14:51:37 +02:00
parent 64a5afb5e0
commit c590ddd963
7 changed files with 22 additions and 19 deletions

BIN
.DS_Store vendored

Binary file not shown.

View file

@ -223,6 +223,8 @@
isa = XCBuildConfiguration; isa = XCBuildConfiguration;
buildSettings = { buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO; ALWAYS_SEARCH_USER_PATHS = NO;
ARCHS = "$(ARCHS_STANDARD_64_BIT)";
CLANG_ENABLE_OBJC_ARC = YES;
COPY_PHASE_STRIP = NO; COPY_PHASE_STRIP = NO;
GCC_DYNAMIC_NO_PIC = NO; GCC_DYNAMIC_NO_PIC = NO;
GCC_ENABLE_FIX_AND_CONTINUE = YES; GCC_ENABLE_FIX_AND_CONTINUE = YES;
@ -240,6 +242,8 @@
isa = XCBuildConfiguration; isa = XCBuildConfiguration;
buildSettings = { buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO; ALWAYS_SEARCH_USER_PATHS = NO;
ARCHS = "$(ARCHS_STANDARD_64_BIT)";
CLANG_ENABLE_OBJC_ARC = YES;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
GCC_MODEL_TUNING = G5; GCC_MODEL_TUNING = G5;
GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PRECOMPILE_PREFIX_HEADER = YES;
@ -260,7 +264,7 @@
GCC_WARN_UNUSED_VARIABLE = YES; GCC_WARN_UNUSED_VARIABLE = YES;
ONLY_ACTIVE_ARCH = YES; ONLY_ACTIVE_ARCH = YES;
PREBINDING = NO; PREBINDING = NO;
SDKROOT = macosx10.6; SDKROOT = macosx;
}; };
name = Debug; name = Debug;
}; };
@ -272,7 +276,7 @@
GCC_WARN_ABOUT_RETURN_TYPE = YES; GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_UNUSED_VARIABLE = YES; GCC_WARN_UNUSED_VARIABLE = YES;
PREBINDING = NO; PREBINDING = NO;
SDKROOT = macosx10.6; SDKROOT = macosx;
}; };
name = Release; name = Release;
}; };

View file

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<Scheme <Scheme
version = "1.3"> version = "1.8">
<BuildAction <BuildAction
parallelizeBuildables = "YES" parallelizeBuildables = "YES"
buildImplicitDependencies = "YES"> buildImplicitDependencies = "YES">
@ -36,7 +36,10 @@
displayScale = "1.00" displayScale = "1.00"
launchStyle = "0" launchStyle = "0"
useCustomWorkingDirectory = "NO" useCustomWorkingDirectory = "NO"
buildConfiguration = "Debug"> buildConfiguration = "Debug"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
allowLocationSimulation = "YES">
<BuildableProductRunnable> <BuildableProductRunnable>
<BuildableReference <BuildableReference
BuildableIdentifier = "primary" BuildableIdentifier = "primary"
@ -55,7 +58,8 @@
shouldUseLaunchSchemeArgsEnv = "YES" shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = "" savedToolIdentifier = ""
useCustomWorkingDirectory = "NO" useCustomWorkingDirectory = "NO"
buildConfiguration = "Release"> buildConfiguration = "Release"
debugDocumentVersioning = "YES">
<BuildableProductRunnable> <BuildableProductRunnable>
<BuildableReference <BuildableReference
BuildableIdentifier = "primary" BuildableIdentifier = "primary"

View file

@ -9,19 +9,19 @@
#import <Cocoa/Cocoa.h> #import <Cocoa/Cocoa.h>
@interface SpeakerAppDelegate : NSObject <NSApplicationDelegate, NSSpeechSynthesizerDelegate> { @interface SpeakerAppDelegate : NSObject <NSApplicationDelegate, NSSpeechSynthesizerDelegate> {
NSWindow *window; NSWindow *__weak window;
NSTextView *textView; NSTextView *textView;
NSMenu *languageMenu; NSMenu *__weak languageMenu;
NSPopUpButton *languageMenuPopupButton; NSPopUpButton *__weak languageMenuPopupButton;
NSSpeechSynthesizer *synth; NSSpeechSynthesizer *synth;
NSRange oldRange; NSRange oldRange;
BOOL isNewLocation; BOOL isNewLocation;
} }
@property (assign) IBOutlet NSWindow *window; @property (weak) IBOutlet NSWindow *window;
@property (retain, nonatomic) IBOutlet NSTextView *textView; @property (strong, nonatomic) IBOutlet NSTextView *textView;
@property (assign) IBOutlet NSMenu *languageMenu; @property (weak) IBOutlet NSMenu *languageMenu;
@property (assign) IBOutlet NSPopUpButton *languageMenuPopupButton; @property (weak) IBOutlet NSPopUpButton *languageMenuPopupButton;
-(IBAction)speakAction:(id)sender; -(IBAction)speakAction:(id)sender;
-(IBAction)seekForward:(id)sender; -(IBAction)seekForward:(id)sender;

View file

@ -30,7 +30,6 @@
if (string) { if (string) {
NSAttributedString *attributedString = [[NSAttributedString alloc] initWithString:string]; NSAttributedString *attributedString = [[NSAttributedString alloc] initWithString:string];
[[textView textStorage] setAttributedString:attributedString]; [[textView textStorage] setAttributedString:attributedString];
[attributedString release];
NSRange aRange = NSMakeRange([defaults integerForKey:@"startLocation"], 0); NSRange aRange = NSMakeRange([defaults integerForKey:@"startLocation"], 0);
[textView setSelectedRange:aRange]; [textView setSelectedRange:aRange];
[textView scrollRangeToVisible:aRange]; [textView scrollRangeToVisible:aRange];
@ -55,7 +54,6 @@
NSMenuItem *item = [[NSMenuItem alloc] initWithTitle:[NSString stringWithFormat:@"%@ - %@", country, [dict objectForKey:@"VoiceName"]] action:@selector(changeLanguage:) keyEquivalent:@""]; NSMenuItem *item = [[NSMenuItem alloc] initWithTitle:[NSString stringWithFormat:@"%@ - %@", country, [dict objectForKey:@"VoiceName"]] action:@selector(changeLanguage:) keyEquivalent:@""];
item.tag = i; item.tag = i;
[self.languageMenu addItem:item]; [self.languageMenu addItem:item];
[item release];
if (![[NSUserDefaults standardUserDefaults] objectForKey:@"languageVoiceIndex"] && [[dict objectForKey:@"VoiceName"] isEqualToString:@"Alex"]) if (![[NSUserDefaults standardUserDefaults] objectForKey:@"languageVoiceIndex"] && [[dict objectForKey:@"VoiceName"] isEqualToString:@"Alex"])
{ {
@ -117,7 +115,8 @@
text = [wholeText substringWithRange:NSMakeRange(range.location, [wholeText length] - range.location)]; text = [wholeText substringWithRange:NSMakeRange(range.location, [wholeText length] - range.location)];
} }
[synth startSpeakingString:text]; [synth stopSpeaking];
[synth startSpeakingString:text];
oldRange = range; oldRange = range;
@ -157,9 +156,5 @@
[textView setEditable:YES]; [textView setEditable:YES];
} }
- (void)dealloc {
[synth release];
[super dealloc];
}
@end @end

BIN
build/.DS_Store vendored Normal file

Binary file not shown.