Skip to content

Commit

Permalink
release auto complete on MMainWnd dtor
Browse files Browse the repository at this point in the history
  • Loading branch information
katahiromz committed Feb 9, 2025
1 parent 0c3cd1d commit a554b86
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 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;
MLangAutoComplete * m_pAutoComplete;
std::shared_ptr<MLangAutoComplete> m_pAutoComplete;

public:
MDropdownArrow m_arrow; // the language drop-down arrow
Expand Down Expand Up @@ -10368,9 +10368,6 @@ 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 @@ -12166,7 +12163,6 @@ void MMainWnd::DoLangEditAutoCompleteRelease(HWND hwnd)
if (m_pAutoComplete)
{
m_pAutoComplete->unbind();
m_pAutoComplete->Release();
m_pAutoComplete = NULL;
}

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

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

Expand Down

0 comments on commit a554b86

Please sign in to comment.