mirror of
https://github.com/notepad-plus-plus/notepad-plus-plus.git
synced 2025-07-30 01:04:57 +02:00
Fix macro playing back crash issue
Fix crash issue while playing back macro if "find previous" and/or "find next" button actions are/is recorded. Also prevent from future crash if new commands in Find dialog are forgotten to be treated.
This commit is contained in:
parent
789cf387df
commit
9b565319e3
@ -2529,6 +2529,8 @@ void FindReplaceDlg::setStatusbarMessage(const generic_string & msg, FindStatus
|
|||||||
}
|
}
|
||||||
|
|
||||||
void FindReplaceDlg::execSavedCommand(int cmd, uptr_t intValue, generic_string stringValue)
|
void FindReplaceDlg::execSavedCommand(int cmd, uptr_t intValue, generic_string stringValue)
|
||||||
|
{
|
||||||
|
try
|
||||||
{
|
{
|
||||||
switch (cmd)
|
switch (cmd)
|
||||||
{
|
{
|
||||||
@ -2572,6 +2574,25 @@ void FindReplaceDlg::execSavedCommand(int cmd, uptr_t intValue, generic_string s
|
|||||||
processFindNext(_env->_str2Search.c_str());
|
processFindNext(_env->_str2Search.c_str());
|
||||||
nppParamInst->_isFindReplacing = false;
|
nppParamInst->_isFindReplacing = false;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case IDC_FINDNEXT:
|
||||||
|
{
|
||||||
|
nppParamInst->_isFindReplacing = true;
|
||||||
|
_options._whichDirection = DIR_DOWN;
|
||||||
|
processFindNext(_env->_str2Search.c_str());
|
||||||
|
nppParamInst->_isFindReplacing = false;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case IDC_FINDPREV:
|
||||||
|
{
|
||||||
|
nppParamInst->_isFindReplacing = true;
|
||||||
|
_env->_whichDirection = DIR_UP;
|
||||||
|
processFindNext(_env->_str2Search.c_str());
|
||||||
|
nppParamInst->_isFindReplacing = false;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
case IDREPLACE:
|
case IDREPLACE:
|
||||||
nppParamInst->_isFindReplacing = true;
|
nppParamInst->_isFindReplacing = true;
|
||||||
processReplace(_env->_str2Search.c_str(), _env->_str4Replace.c_str(), _env);
|
processReplace(_env->_str2Search.c_str(), _env->_str4Replace.c_str(), _env);
|
||||||
@ -2701,9 +2722,11 @@ void FindReplaceDlg::execSavedCommand(int cmd, uptr_t intValue, generic_string s
|
|||||||
setStatusbarMessage(result, FSMessage);
|
setStatusbarMessage(result, FSMessage);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
default:
|
default:
|
||||||
throw std::runtime_error("Internal error: unknown saved command!");
|
throw std::runtime_error("Internal error: unknown saved command!");
|
||||||
}
|
}
|
||||||
|
|
||||||
delete _env;
|
delete _env;
|
||||||
_env = &_options;
|
_env = &_options;
|
||||||
break;
|
break;
|
||||||
@ -2712,6 +2735,11 @@ void FindReplaceDlg::execSavedCommand(int cmd, uptr_t intValue, generic_string s
|
|||||||
throw std::runtime_error("Internal error: unknown SnR command!");
|
throw std::runtime_error("Internal error: unknown SnR command!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
catch (std::runtime_error err)
|
||||||
|
{
|
||||||
|
MessageBoxA(NULL, err.what(), "Play Macro Exception", MB_OK);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void FindReplaceDlg::setFindInFilesDirFilter(const TCHAR *dir, const TCHAR *filters)
|
void FindReplaceDlg::setFindInFilesDirFilter(const TCHAR *dir, const TCHAR *filters)
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user