StyledEdit: avoid crash on replace window

* Fixes #13842
This commit is contained in:
Janus 2017-12-08 15:03:10 +01:00
parent 2d10453741
commit da9188ac28
4 changed files with 17 additions and 0 deletions

View File

@ -44,6 +44,7 @@ const uint32 MSG_REPLACE = 'msre';
const uint32 MSG_REPLACE_ALL = 'mrea';
const uint32 MSG_HIDE_WINDOW = 'mhdw';
const uint32 MSG_FIND_WINDOW_QUIT = 'mfwq';
const uint32 MSG_REPLACE_WINDOW_QUIT = 'mrwq';
// "Font"-menu
const uint32 FONT_SIZE = 'FMsi';

View File

@ -157,6 +157,16 @@ ReplaceWindow::DispatchMessage(BMessage* message, BHandler* handler)
}
bool
ReplaceWindow::QuitRequested()
{
BMessenger messenger(fHandler);
messenger.SendMessage(MSG_REPLACE_WINDOW_QUIT);
return true;
}
void
ReplaceWindow::Show()
{

View File

@ -29,6 +29,7 @@ class ReplaceWindow : public BWindow {
virtual void MessageReceived(BMessage* message);
virtual void DispatchMessage(BMessage* message, BHandler* handler);
virtual bool QuitRequested();
virtual void Show();
private:

View File

@ -263,6 +263,11 @@ StyledEditWindow::MessageReceived(BMessage* message)
fFindWindow = NULL;
break;
}
case MSG_REPLACE_WINDOW_QUIT:
{
fReplaceWindow = NULL;
break;
}
case MSG_SEARCH:
message->FindString("findtext", &fStringToFind);
fFindAgainItem->SetEnabled(true);