Fix refcount crash with find again. (bug 150532)

This commit is contained in:
pinkerton%netscape.com 2002-06-11 15:00:15 +00:00
Родитель 292eadf526
Коммит a250656d2b
8 изменённых файлов: 84 добавлений и 8 удалений

Просмотреть файл

@ -50,6 +50,7 @@
-(IBAction) find: (id)aSender;
-(IBAction) findAgain: (id)aSender;
-(void) storeSearchText:(NSString*)inText;
// delegates for NSTextView
- (void)controlTextDidChange:(NSNotification *)aNotification;

Просмотреть файл

@ -42,12 +42,23 @@
@implementation FindDlgController
- (id)initWithWindowNibName:(NSString *)windowNibName
{
if ( (self = [super initWithWindowNibName:windowNibName]) )
mSearchText = nil;
return self;
}
- (void)dealloc
{
[mSearchText release];
}
- (void)windowDidLoad
{
}
//
// -find
//
@ -59,7 +70,7 @@
NSWindowController* controller = [[NSApp mainWindow] windowController];
if ( [controller conformsToProtocol:@protocol(CHFind)] ) {
id<CHFind> browserController = controller;
mSearchText = [mSearchField stringValue];
[self storeSearchText:[mSearchField stringValue]];
BOOL found = [browserController findInPage:mSearchText];
if ( found )
[self close];
@ -104,4 +115,11 @@
[mFindButton setEnabled:PR_FALSE];
}
- (void)storeSearchText:(NSString*)inText
{
[mSearchText autorelease];
mSearchText = inText;
[mSearchText retain];
}
@end

Просмотреть файл

@ -50,6 +50,7 @@
-(IBAction) find: (id)aSender;
-(IBAction) findAgain: (id)aSender;
-(void) storeSearchText:(NSString*)inText;
// delegates for NSTextView
- (void)controlTextDidChange:(NSNotification *)aNotification;

Просмотреть файл

@ -42,12 +42,23 @@
@implementation FindDlgController
- (id)initWithWindowNibName:(NSString *)windowNibName
{
if ( (self = [super initWithWindowNibName:windowNibName]) )
mSearchText = nil;
return self;
}
- (void)dealloc
{
[mSearchText release];
}
- (void)windowDidLoad
{
}
//
// -find
//
@ -59,7 +70,7 @@
NSWindowController* controller = [[NSApp mainWindow] windowController];
if ( [controller conformsToProtocol:@protocol(CHFind)] ) {
id<CHFind> browserController = controller;
mSearchText = [mSearchField stringValue];
[self storeSearchText:[mSearchField stringValue]];
BOOL found = [browserController findInPage:mSearchText];
if ( found )
[self close];
@ -104,4 +115,11 @@
[mFindButton setEnabled:PR_FALSE];
}
- (void)storeSearchText:(NSString*)inText
{
[mSearchText autorelease];
mSearchText = inText;
[mSearchText retain];
}
@end

Просмотреть файл

@ -50,6 +50,7 @@
-(IBAction) find: (id)aSender;
-(IBAction) findAgain: (id)aSender;
-(void) storeSearchText:(NSString*)inText;
// delegates for NSTextView
- (void)controlTextDidChange:(NSNotification *)aNotification;

Просмотреть файл

@ -42,12 +42,23 @@
@implementation FindDlgController
- (id)initWithWindowNibName:(NSString *)windowNibName
{
if ( (self = [super initWithWindowNibName:windowNibName]) )
mSearchText = nil;
return self;
}
- (void)dealloc
{
[mSearchText release];
}
- (void)windowDidLoad
{
}
//
// -find
//
@ -59,7 +70,7 @@
NSWindowController* controller = [[NSApp mainWindow] windowController];
if ( [controller conformsToProtocol:@protocol(CHFind)] ) {
id<CHFind> browserController = controller;
mSearchText = [mSearchField stringValue];
[self storeSearchText:[mSearchField stringValue]];
BOOL found = [browserController findInPage:mSearchText];
if ( found )
[self close];
@ -104,4 +115,11 @@
[mFindButton setEnabled:PR_FALSE];
}
- (void)storeSearchText:(NSString*)inText
{
[mSearchText autorelease];
mSearchText = inText;
[mSearchText retain];
}
@end

Просмотреть файл

@ -50,6 +50,7 @@
-(IBAction) find: (id)aSender;
-(IBAction) findAgain: (id)aSender;
-(void) storeSearchText:(NSString*)inText;
// delegates for NSTextView
- (void)controlTextDidChange:(NSNotification *)aNotification;

Просмотреть файл

@ -42,12 +42,23 @@
@implementation FindDlgController
- (id)initWithWindowNibName:(NSString *)windowNibName
{
if ( (self = [super initWithWindowNibName:windowNibName]) )
mSearchText = nil;
return self;
}
- (void)dealloc
{
[mSearchText release];
}
- (void)windowDidLoad
{
}
//
// -find
//
@ -59,7 +70,7 @@
NSWindowController* controller = [[NSApp mainWindow] windowController];
if ( [controller conformsToProtocol:@protocol(CHFind)] ) {
id<CHFind> browserController = controller;
mSearchText = [mSearchField stringValue];
[self storeSearchText:[mSearchField stringValue]];
BOOL found = [browserController findInPage:mSearchText];
if ( found )
[self close];
@ -104,4 +115,11 @@
[mFindButton setEnabled:PR_FALSE];
}
- (void)storeSearchText:(NSString*)inText
{
[mSearchText autorelease];
mSearchText = inText;
[mSearchText retain];
}
@end