Browse Source

Fix the toolbars leak

master
boisso 7 years ago
parent
commit
a6eea26a87
  1. 1
      k-meleon/BrowserFrm.cpp
  2. 4
      k-meleon/KmToolbar.cpp
  3. 7
      k-meleon/ReBarEx.cpp
  4. 1
      k-meleon/ReBarEx.h

1
k-meleon/BrowserFrm.cpp

@ -319,6 +319,7 @@ void CBrowserFrame::OnDestroy()
if (!IsDialog())
theApp.plugins.SendMessage("*", "* OnClose", "Destroy", (long)m_hWnd);
theApp.toolbars.CloseWindow(this);
m_wndStatusBar.RemoveIcon(ID_SECURITY_STATE_ICON);
CFrameWnd::OnDestroy();
}

4
k-meleon/KmToolbar.cpp

@ -250,6 +250,7 @@ void KmToolbar::Remove(CToolBarEx* hToolbar)
}
mToolbars.GetNext(pos);
}
ASSERT(pos != mToolbars.GetTailPosition());
}
bool KmToolbar::Init(CToolBarEx* hToolbar)
@ -302,6 +303,9 @@ void KmToolbarService::CloseWindow(CBrowserFrame* frame)
POSITION pos = mToolbars.GetStartPosition();
while (pos) {
mToolbars.GetNextAssoc( pos, s, ktoolbar);
CToolBarEx* hToolbar = (CToolBarEx*)CWnd::FromHandle(frame->m_wndReBar.GetChildByName(s));
ASSERT(hToolbar);
ktoolbar->Remove(hToolbar);
}
}

7
k-meleon/ReBarEx.cpp

@ -355,6 +355,13 @@ int CReBarEx::FindByChild(HWND hWnd) {
return -1;
}
HWND CReBarEx::GetChildByName(const TCHAR *name) {
for (int x=0; x<m_iCount; x++)
if (m_index[x]->name && _tcsicmp(name, m_index[x]->name) == 0)
return m_index[x]->hWnd;
return NULL;
}
int CReBarEx::FindByName(const TCHAR *name) {
for (int x=0; x<m_iCount; x++)
if (m_index[x]->name && _tcsicmp(name, m_index[x]->name) == 0)

1
k-meleon/ReBarEx.h

@ -39,6 +39,7 @@ public:
HMENU m_menu;
int FindByName(const TCHAR *name);
HWND GetChildByName(const TCHAR *name);
void ShowBand(int index, BOOL visibility);
int count() { return m_iCount; }
void lineup();

Loading…
Cancel
Save