I have been updating the search/replace support in an app to use the built in 
system functions rather than my somewhat fiddley home brew version of the past 
and have run into a problem with the NSTextViewMBS.usesFindPanel command. In 
the previous pr release of the plugins I was running it sometimes crashed at 
this point: 

    dim n as NSTextViewMBS = ScriptField.NSTextViewMBS
    
    //the crash occurs here
    n.usesFindPanel = true

It was very difficult to debug as it only happened about every dozen times I 
would open a window that wanted to display the find dialog. I updated to the 
164 release and I’m no longer crashing, I seem to be able to catch the 
NSException now where I couldn’t before and I get an exception with the message 
of:

NSInvalidArgumentException was not handled: -[__NSCFDictionary 
_isSearchingAsynchronousDocument]: unrecognized selector sent to instance 
0xfd82b80: -[__NSCFDictionary _isSearchingAsynchronousDocument]: unrecognized 
selector sent to instance 0xfd82b80

or

NSInvalidArgumentException was not handled: -[NSRegion 
_isSearchingAsynchronousDocument]: unrecognized selector sent to instance 
0x112609e0: -[NSRegion _isSearchingAsynchronousDocument]: unrecognized selector 
sent to instance 0x112609e0

and the find panel doesn’t open, but at least it doesn’t crash anymore :) The 
window with the text in it that I’m opening the find panel for is actually 
selected from a larger meta search window that looks through many scripts in 
the system and so the window doesn’t exist when it’s opened. I load the text 
into the field and then highlight some text in order to call the set search 
text which works and then I open the search window by turning on usesFindPanel 
and sometimes randomly this just doesn’t work. I tried moving the setup of the 
find panel to the activate event of the window and even to a timer in the 
window offset by half a second thinking that something just wasn’t ready with 
the text field before I tried to do that, but even moving it out by half a 
second doesn’t make it work any more reliably.

Is there some way I can check to make sure the field is ready to open this? Or 
is this a bug somewhere else? I am out of ideas for how to make sure it’s ready 
or valid or whatever I need to do to get it to work reliably. Any suggestions 
welcome!



Thanks,
 James


James Sentman                       http://www.PlanetaryGear.org                
http://MacHomeAutomation.com




_______________________________________________
Mbsplugins_monkeybreadsoftware.info mailing list
[email protected]
https://ml01.ispgateway.de/mailman/listinfo/mbsplugins_monkeybreadsoftware.info

Reply via email to