mirror of
https://github.com/notepad-plus-plus/notepad-plus-plus.git
synced 2025-07-23 05:45:00 +02:00
[BUG_FIXED] Fix memory leak problem while switching tab.
git-svn-id: svn://svn.tuxfamily.org/svnroot/notepadplus/repository/trunk@694 f5eea248-9336-0410-98b8-ebc06183d4e3
This commit is contained in:
parent
4feab306b0
commit
549e5f5f29
@ -4105,19 +4105,29 @@ void Notepad_plus::notifyBufferChanged(Buffer * buffer, int mask)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Notepad_plus::notifyBufferActivated(BufferID bufid, int view) {
|
void Notepad_plus::notifyBufferActivated(BufferID bufid, int view)
|
||||||
|
{
|
||||||
|
|
||||||
Buffer * buf = MainFileManager->getBufferByID(bufid);
|
Buffer * buf = MainFileManager->getBufferByID(bufid);
|
||||||
buf->increaseRecentTag();
|
buf->increaseRecentTag();
|
||||||
|
|
||||||
if (view == MAIN_VIEW) {
|
NppParameters *pNppParam = NppParameters::getInstance();
|
||||||
_autoCompleteMain.setLanguage(buf->getLangType());
|
const NppGUI & nppGUI = pNppParam->getNppGUI();
|
||||||
} else if (view == SUB_VIEW) {
|
if (nppGUI._autocStatus == nppGUI.autoc_func)
|
||||||
_autoCompleteSub.setLanguage(buf->getLangType());
|
{
|
||||||
|
if (view == MAIN_VIEW)
|
||||||
|
{
|
||||||
|
_autoCompleteMain.setLanguage(buf->getLangType());
|
||||||
|
}
|
||||||
|
else if (view == SUB_VIEW)
|
||||||
|
{
|
||||||
|
_autoCompleteSub.setLanguage(buf->getLangType());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (view != currentView()) {
|
if (view != currentView())
|
||||||
return; //dont care if another view did something
|
return; //dont care if another view did something
|
||||||
}
|
|
||||||
|
|
||||||
checkDocState();
|
checkDocState();
|
||||||
dynamicCheckMenuAndTB();
|
dynamicCheckMenuAndTB();
|
||||||
|
@ -28,13 +28,6 @@ static bool isInList(generic_string word, const vector<generic_string> & wordArr
|
|||||||
return false;
|
return false;
|
||||||
};
|
};
|
||||||
|
|
||||||
AutoCompletion::AutoCompletion(ScintillaEditView * pEditView) : _funcCompletionActive(false), _pEditView(pEditView), _funcCalltip(pEditView),
|
|
||||||
_curLang(L_TEXT), _XmlFile(TEXT("")), _activeCompletion(CompletionNone),
|
|
||||||
_pXmlKeyword(NULL), _ignoreCase(true), _keyWords(TEXT(""))
|
|
||||||
{
|
|
||||||
//Do not load any language yet
|
|
||||||
}
|
|
||||||
|
|
||||||
bool AutoCompletion::showAutoComplete() {
|
bool AutoCompletion::showAutoComplete() {
|
||||||
if (!_funcCompletionActive)
|
if (!_funcCompletionActive)
|
||||||
return false;
|
return false;
|
||||||
@ -214,13 +207,16 @@ bool AutoCompletion::setLanguage(LangType language) {
|
|||||||
lstrcat(path, getApiFileName());
|
lstrcat(path, getApiFileName());
|
||||||
lstrcat(path, TEXT(".xml"));
|
lstrcat(path, TEXT(".xml"));
|
||||||
|
|
||||||
_XmlFile = TiXmlDocument(path);
|
if (_pXmlFile)
|
||||||
_funcCompletionActive = _XmlFile.LoadFile();
|
delete _pXmlFile;
|
||||||
|
|
||||||
|
_pXmlFile = new TiXmlDocument(path);
|
||||||
|
_funcCompletionActive = _pXmlFile->LoadFile();
|
||||||
|
|
||||||
TiXmlNode * pAutoNode = NULL;
|
TiXmlNode * pAutoNode = NULL;
|
||||||
if (_funcCompletionActive) {
|
if (_funcCompletionActive) {
|
||||||
_funcCompletionActive = false; //safety
|
_funcCompletionActive = false; //safety
|
||||||
TiXmlNode * pNode = _XmlFile.FirstChild(TEXT("NotepadPlus"));
|
TiXmlNode * pNode = _pXmlFile->FirstChild(TEXT("NotepadPlus"));
|
||||||
if (!pNode)
|
if (!pNode)
|
||||||
return false;
|
return false;
|
||||||
pAutoNode = pNode = pNode->FirstChildElement(TEXT("AutoComplete"));
|
pAutoNode = pNode = pNode->FirstChildElement(TEXT("AutoComplete"));
|
||||||
|
@ -31,7 +31,18 @@ class ScintillaEditView;
|
|||||||
class AutoCompletion {
|
class AutoCompletion {
|
||||||
public:
|
public:
|
||||||
enum ActiveCompletion {CompletionNone = 0, CompletionAuto, CompletionWord, CompletionFunc};
|
enum ActiveCompletion {CompletionNone = 0, CompletionAuto, CompletionWord, CompletionFunc};
|
||||||
AutoCompletion(ScintillaEditView * pEditView);
|
|
||||||
|
AutoCompletion(ScintillaEditView * pEditView) : _funcCompletionActive(false), _pEditView(pEditView), _funcCalltip(pEditView),
|
||||||
|
_curLang(L_TEXT), _pXmlFile(NULL), _activeCompletion(CompletionNone),
|
||||||
|
_pXmlKeyword(NULL), _ignoreCase(true), _keyWords(TEXT("")) {
|
||||||
|
//Do not load any language yet
|
||||||
|
};
|
||||||
|
|
||||||
|
~AutoCompletion(){
|
||||||
|
if (_pXmlFile)
|
||||||
|
delete _pXmlFile;
|
||||||
|
};
|
||||||
|
|
||||||
bool setLanguage(LangType language);
|
bool setLanguage(LangType language);
|
||||||
|
|
||||||
//AutoComplete from the list
|
//AutoComplete from the list
|
||||||
@ -48,8 +59,8 @@ private:
|
|||||||
bool _funcCompletionActive;
|
bool _funcCompletionActive;
|
||||||
ScintillaEditView * _pEditView;
|
ScintillaEditView * _pEditView;
|
||||||
LangType _curLang;
|
LangType _curLang;
|
||||||
TiXmlDocument _XmlFile;
|
TiXmlDocument *_pXmlFile;
|
||||||
TiXmlElement * _pXmlKeyword;
|
TiXmlElement *_pXmlKeyword;
|
||||||
ActiveCompletion _activeCompletion;
|
ActiveCompletion _activeCompletion;
|
||||||
|
|
||||||
bool _ignoreCase;
|
bool _ignoreCase;
|
||||||
|
@ -880,7 +880,7 @@ protected:
|
|||||||
|
|
||||||
bool isCJK() const {
|
bool isCJK() const {
|
||||||
return ((_codepage == CP_CHINESE_TRADITIONAL) || (_codepage == CP_CHINESE_SIMPLIFIED) ||
|
return ((_codepage == CP_CHINESE_TRADITIONAL) || (_codepage == CP_CHINESE_SIMPLIFIED) ||
|
||||||
(_codepage == CP_JAPANESE) || (_codepage == CP_KOREAN) || (_codepage == CP_GREEK));
|
(_codepage == CP_JAPANESE) || (_codepage == CP_KOREAN));
|
||||||
};
|
};
|
||||||
|
|
||||||
int codepage2CharSet() const {
|
int codepage2CharSet() const {
|
||||||
|
@ -1713,39 +1713,6 @@ BOOL CALLBACK PrintSettingsDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
BOOL CALLBACK PrintSettings2Dlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM)
|
|
||||||
{
|
|
||||||
NppParameters *pNppParam = NppParameters::getInstance();
|
|
||||||
NppGUI & nppGUI = (NppGUI & )pNppParam->getNppGUI();
|
|
||||||
|
|
||||||
switch (Message)
|
|
||||||
{
|
|
||||||
case WM_INITDIALOG :
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
case WM_COMMAND :
|
|
||||||
{
|
|
||||||
if (HIWORD(wParam) == EN_CHANGE)
|
|
||||||
{
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
switch (wParam)
|
|
||||||
{
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
BOOL CALLBACK BackupDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM)
|
BOOL CALLBACK BackupDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM)
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user