Skip to content

Commit

Permalink
release auto complete on MMainWnd dtor 2
Browse files Browse the repository at this point in the history
  • Loading branch information
katahiromz committed Feb 9, 2025
1 parent 8f37251 commit c040ba9
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/RisohEditor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2238,7 +2238,7 @@ class MMainWnd : public MWindowBase

// auto completion
MLangAutoCompleteEdit m_auto_comp_edit;
std::shared_ptr<MLangAutoComplete> m_pAutoComplete;
MLangAutoComplete *m_pAutoComplete;

public:
MDropdownArrow m_arrow; // the language drop-down arrow
Expand Down Expand Up @@ -10369,6 +10369,9 @@ void MMainWnd::OnClose(HWND hwnd)
// WM_DESTROY: the main window has been destroyed
void MMainWnd::OnDestroy(HWND hwnd)
{
// release auto complete
DoLangEditAutoCompleteRelease(hwnd);

// close preview
HidePreview();

Expand Down Expand Up @@ -12164,6 +12167,7 @@ void MMainWnd::DoLangEditAutoCompleteRelease(HWND hwnd)
if (m_pAutoComplete)
{
m_pAutoComplete->unbind();
m_pAutoComplete->Release();
m_pAutoComplete = NULL;
}

Expand All @@ -12174,7 +12178,7 @@ void MMainWnd::DoLangEditAutoComplete(HWND hwnd, HWND hwndEdit)
{
DoLangEditAutoCompleteRelease(hwnd);

m_pAutoComplete = std::make_shared<MLangAutoComplete>();
m_pAutoComplete = new MLangAutoComplete();
if (!m_pAutoComplete)
return;

Expand Down

0 comments on commit c040ba9

Please sign in to comment.