Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix 'Do not throw uncaught exceptions in a destructor.' #1854

Merged
merged 1 commit into from
Jun 12, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
fix 'Do not throw uncaught exceptions in a destructor.'
  • Loading branch information
sanomari committed Jun 12, 2022
commit 2ebe5a4695ca31fad9ece936b3134ba4184c9bd0
16 changes: 7 additions & 9 deletions sakura_core/CGrepAgent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1738,17 +1738,20 @@ class CError_WriteFileOpen

class CWriteData{
public:
CWriteData(int& hit, LPCWSTR name, ECodeType code_, bool bBom_, bool bOldSave_, CNativeW& message)
CWriteData(int& hit, LPCWSTR name_, ECodeType code_, bool bBom_, bool bOldSave_, CNativeW& message)
:nHitCount(hit)
,fileName(name)
,fileName(name_)
,name(name_)
,code(code_)
,bBom(bBom_)
,bOldSave(bOldSave_)
,bufferSize(0)
,out(NULL)
,pcCodeBase(CCodeFactory::CreateCodeBase(code_,0))
,memMessage(message)
{}
{
name += L".skrnew";
}
void AppendBuffer(const CNativeW& strLine)
{
if( !out ){
Expand All @@ -1765,8 +1768,6 @@ class CWriteData{
void OutputHead()
{
if( !out ){
std::wstring name = fileName;
name += L".skrnew";
try{
out = new CBinaryOutputStream(name.c_str(), true);
}catch( const CError_FileOpen& ){
Expand Down Expand Up @@ -1819,8 +1820,6 @@ class CWriteData{
return;
}
}
std::wstring name(fileName);
name += L".skrnew";
if( FALSE == ::MoveFile( name.c_str(), fileName ) ){
memMessage.AppendString( LS(STR_GREP_REP_ERR_REPLACE) );
memMessage.AppendStringF( L"[%s]\r\n", fileName );
Expand All @@ -1835,14 +1834,13 @@ class CWriteData{
out->Close();
delete out;
out = NULL;
std::wstring name(fileName);
name += L".skrnew";
::DeleteFile( name.c_str() );
}
}
private:
int& nHitCount;
LPCWSTR fileName;
std::wstring name;
ECodeType code;
bool bBom;
bool bOldSave;
Expand Down