mirror of
https://github.com/notepad-plus-plus/notepad-plus-plus.git
synced 2025-07-29 16:54:43 +02:00
Fix the crash due to NPPM_DESTROYSCINTILLAHANDLE message
Destroying allocated Scintilla makes Notepad++ crash because created Scintilla view's pointer is added into _referees of Buffer object automatically. The deallocated scintilla view in _referees is used in Buffer::nextUntitledNewNumber(). So we do nothing here and let Notepad++ destroys allocated Scintilla while it exit and we keep this message for the sake of compability withe the existing plugins. Fix #4487, close #1500, close #5949
This commit is contained in:
parent
21939308b0
commit
4a80a125c0
@ -1244,7 +1244,15 @@ LRESULT Notepad_plus::process(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPa
|
|||||||
|
|
||||||
case NPPM_DESTROYSCINTILLAHANDLE:
|
case NPPM_DESTROYSCINTILLAHANDLE:
|
||||||
{
|
{
|
||||||
return _scintillaCtrls4Plugins.destroyScintilla(reinterpret_cast<HWND>(lParam));
|
//return _scintillaCtrls4Plugins.destroyScintilla(reinterpret_cast<HWND>(lParam));
|
||||||
|
|
||||||
|
// Destroying allocated Scintilla makes Notepad++ crash
|
||||||
|
// because created Scintilla view's pointer is added into _referees of Buffer object automatically.
|
||||||
|
// The deallocated scintilla view in _referees is used in Buffer::nextUntitledNewNumber().
|
||||||
|
|
||||||
|
// So we do nothing here and let Notepad++ destroy allocated Scintilla while it exits
|
||||||
|
// and we keep this message for the sake of compability withe the existing plugins.
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
case NPPM_GETNBUSERLANG:
|
case NPPM_GETNBUSERLANG:
|
||||||
|
@ -58,6 +58,7 @@ ScintillaEditView * ScintillaCtrls::getScintillaEditViewFrom(HWND handle2Find)
|
|||||||
return _scintVector[i];
|
return _scintVector[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
bool ScintillaCtrls::destroyScintilla(HWND handle2Destroy)
|
bool ScintillaCtrls::destroyScintilla(HWND handle2Destroy)
|
||||||
{
|
{
|
||||||
int i = getIndexFrom(handle2Destroy);
|
int i = getIndexFrom(handle2Destroy);
|
||||||
@ -71,6 +72,7 @@ bool ScintillaCtrls::destroyScintilla(HWND handle2Destroy)
|
|||||||
_scintVector.erase(it2delete);
|
_scintVector.erase(it2delete);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
void ScintillaCtrls::destroy()
|
void ScintillaCtrls::destroy()
|
||||||
{
|
{
|
||||||
|
@ -43,7 +43,7 @@ public :
|
|||||||
|
|
||||||
HWND createSintilla(HWND hParent);
|
HWND createSintilla(HWND hParent);
|
||||||
ScintillaEditView * getScintillaEditViewFrom(HWND handle2Find);
|
ScintillaEditView * getScintillaEditViewFrom(HWND handle2Find);
|
||||||
bool destroyScintilla(HWND handle2Destroy);
|
//bool destroyScintilla(HWND handle2Destroy);
|
||||||
void destroy();
|
void destroy();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user