![]() |
Commandbar memory leaks |
Post Reply ![]() |
Author | |
prashant ![]() Senior Member ![]() ![]() Joined: 19 February 2007 Location: India Status: Offline Points: 165 |
![]() ![]() ![]() ![]() ![]() Posted: 06 March 2009 at 2:29am |
Oleg,
I am creating a toolbar having multiple toolbars on it. My code goes as follows, I am getting memory leaks. I have this code in place in Split Windows (multiple views) createtoolbar function. Last time I discovered that I have call InitCommandBars() in Mainfrm as well as in childfrm and causes memory leaks. What is the reason this time? Code: // Initialize the command bars if(!InitCommandBars()) return; // Get Commandbar pCommandBars = GetCommandBars(); if(NULL == pCommandBars) return; /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ///!<Primary View Name> m_pWndPrimViewToolBar = (CMVToolBarPrimViewName *)pCommandBars->Add(g_cmcmvprimaryview, xtpBarTop, RUNTIME_CLASS(CMVToolBarPrimViewName)); SetPriViewNamesTB(m_pWndPrimViewToolBar); if (!m_pWndPrimViewToolBar || !m_pWndPrimViewToolBar->LoadToolBar(IDR_PRIMARY_VIEWNAMES_TOOLBAR_)) { TRACE0("Failed to create toolbar\n"); return; } m_pWndPrimViewToolBar->SetContextMenuPresent(FALSE); m_pWndPrimViewToolBar->ShowExpandButton(FALSE); m_pWndPrimViewToolBar->EnableCustomization(FALSE); m_pWndPrimViewToolBar->CreateControl(); /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ///!<Date Range Edit Box> CMVToolBarDateRange *m_pWndDateRangeToolBar; m_pWndDateRangeToolBar = (CMVToolBarDateRange *)pCommandBars->Add(g_cmcmvdaterange, xtpBarTop, RUNTIME_CLASS(CMVToolBarDateRange)); SetDateRangeTB(m_pWndDateRangeToolBar); if (!m_pWndDateRangeToolBar || !m_pWndDateRangeToolBar->LoadToolBar(IDR_DATE_RANGE_)) { TRACE0("Failed to create toolbar\n"); return; } m_pWndDateRangeToolBar->SetContextMenuPresent(FALSE); m_pWndDateRangeToolBar->ShowExpandButton(FALSE); m_pWndDateRangeToolBar->EnableCustomization(FALSE); m_pWndDateRangeToolBar->CreateControl(); DockRightOf(m_pWndDateRangeToolBar, m_pWndPrimViewToolBar); /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ///!<Item Picker> CMVToolBarItemPicker *m_pWndItemPickerToolBar; m_pWndItemPickerToolBar = (CMVToolBarItemPicker *)pCommandBars->Add(g_cmcmvitempick, xtpBarTop, RUNTIME_CLASS(CMVToolBarItemPicker)); SetItemPickTB(m_pWndItemPickerToolBar); if (!m_pWndItemPickerToolBar || !m_pWndItemPickerToolBar->LoadToolBar(IDR_MULTIVIEW_ITEMPICK_TOOLBAR_)) { TRACE0("Failed to create toolbar\n"); return; } m_pWndItemPickerToolBar->SetContextMenuPresent(FALSE); m_pWndItemPickerToolBar->ShowExpandButton(FALSE); m_pWndItemPickerToolBar->EnableCustomization(FALSE); m_pWndItemPickerToolBar->CreateControl(); DockRightOf(m_pWndItemPickerToolBar, m_pWndPrimViewToolBar); /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ///!<KeyWord Search> CMVToolBarKeyWordSearch *m_pWndKeyWordSearchToolBar; m_pWndKeyWordSearchToolBar = (CMVToolBarKeyWordSearch *)pCommandBars->Add(g_cmcmvkeyword, xtpBarTop, RUNTIME_CLASS(CMVToolBarKeyWordSearch)); SetKeyWordTB(m_pWndKeyWordSearchToolBar); if (!m_pWndKeyWordSearchToolBar || !m_pWndKeyWordSearchToolBar->LoadToolBar(IDR_MVTB_KEY_WORD_SEARCH)) { TRACE0("Failed to create toolbar\n"); return; } m_pWndKeyWordSearchToolBar->SetContextMenuPresent(FALSE); m_pWndKeyWordSearchToolBar->ShowExpandButton(FALSE); m_pWndKeyWordSearchToolBar->EnableCustomization(FALSE); m_pWndKeyWordSearchToolBar->CreateControl(); DockRightOf(m_pWndKeyWordSearchToolBar, m_pWndPrimViewToolBar); /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// GetItemPickTB()->SetParentSpltWnd(this); GetDateRangeTB()->SetParentSpltWnd(this); GetKeyWordTB()->SetParentSpltWnd(this); //////////////////////////////////////////////////////////////// GetItemPickTB()->SetWindowText(g_cmcmvitempick); GetDateRangeTB()->SetWindowText(g_cmcmvdaterange); GetKeyWordTB()->SetWindowText(g_cmcmvkeyword); GetPriViewNamesTB()->SetWindowText(g_cmcmvprimaryview); //////////////////////////////////////////////////////////////// GetDateRangeTB()->SetVisible(FALSE); GetItemPickTB()->SetVisible(FALSE); GetKeyWordTB()->SetVisible(FALSE); GetPriViewNamesTB()->SetVisible(FALSE); Leaks: C:\Program Files\Codejock Software\MFC\Xtreme ToolkitPro v12.1.1\Source\Common\XTPToolTipContext.cpp(1938) : {175651} client block at 0x06261770, subtype 0, 92 bytes long. a CToolTipCtrl object at $06261770, 92 bytes long strcore.cpp(118) : {108426} normal block at 0x0624DD78, 18 bytes long. Data: < Mont> 01 00 00 00 05 00 00 00 05 00 00 00 4D 6F 6E 74 strcore.cpp(118) : {107396} normal block at 0x0625F1B0, 35 bytes long. Data: < Frid> 01 00 00 00 16 00 00 00 16 00 00 00 46 72 69 64 C:\Program Files\Codejock Software\MFC\Xtreme ToolkitPro v12.1.1\Source\CommandBars\XTPCommandBar.cpp(200) : {107143} normal block at 0x0625F0D0, 48 bytes long. Data: <Xí% âJ_ > 58 ED 25 06 88 E2 4A 5F 00 00 00 00 00 00 00 00 C:\Program Files\Codejock Software\MFC\Xtreme ToolkitPro v12.1.1\Source\CommandBars\XTPControls.cpp(51) : {107142} client block at 0x0625F048, subtype 0, 68 bytes long. a CXTPControls object at $0625F048, 68 bytes long strcore.cpp(118) : {107141} normal block at 0x0625EFF0, 23 bytes long. Data: < user> 01 00 00 00 0A 00 00 00 0A 00 00 00 75 73 65 72 C:\Program Files\Codejock Software\MFC\Xtreme ToolkitPro v12.1.1\Source\CommandBars\XTPPopupBar.cpp(85) : {107140} client block at 0x0625ED58, subtype 0, 596 bytes long. a CXTPPopupBar object at $0625ED58, 596 bytes long strcore.cpp(118) : {107139} normal block at 0x0625ED00, 23 bytes long. Data: < user> 01 00 00 00 0A 00 00 00 0A 00 00 00 75 73 65 72 C:\Program Files\Codejock Software\MFC\Xtreme ToolkitPro v12.1.1\Source\CommandBars\XTPToolBar.cpp(714) : {107138} client block at 0x0625EB38, subtype 0, 392 bytes long. a CXTPControlPopup object at $0625EB38, 392 bytes long strcore.cpp(118) : {56362} normal block at 0x022564C0, 18 bytes long. Data: < Toda> 01 00 00 00 05 00 00 00 05 00 00 00 54 6F 64 61 strcore.cpp(118) : {56344} normal block at 0x022565C0, 54 bytes long. Data: < ) ) Move> 01 00 00 00 29 00 00 00 29 00 00 00 4D 6F 76 65 strcore.cpp(118) : {56343} normal block at 0x02256558, 35 bytes long. Data: < Next> 02 00 00 00 16 00 00 00 16 00 00 00 4E 65 78 74 strcore.cpp(118) : {56341} normal block at 0x02256190, 23 bytes long. Data: < user> 01 00 00 00 0A 00 00 00 0A 00 00 00 75 73 65 72 C:\Program Files\Codejock Software\MFC\Xtreme ToolkitPro v12.1.1\Source\CommandBars\XTPControlButton.cpp(35) : {56340} client block at 0x02256308, subtype 0, 372 bytes long. a CXTPControlButton object at $02256308, 372 bytes long strcore.cpp(118) : {56339} normal block at 0x02256290, 58 bytes long. Data: < - - Move> 01 00 00 00 2D 00 00 00 2D 00 00 00 4D 6F 76 65 strcore.cpp(118) : {56338} normal block at 0x02256228, 39 bytes long. Data: < Prev> 02 00 00 00 1A 00 00 00 1A 00 00 00 50 72 65 76 strcore.cpp(118) : {56336} normal block at 0x0224FFA8, 23 bytes long. Data: < user> 01 00 00 00 0A 00 00 00 0A 00 00 00 75 73 65 72 C:\Program Files\Codejock Software\MFC\Xtreme ToolkitPro v12.1.1\Source\CommandBars\XTPControlButton.cpp(35) : {56335} client block at 0x02255FD8, subtype 0, 372 bytes long. a CXTPControlButton object at $02255FD8, 372 bytes long afxtempl.h(370) : {56334} normal block at 0x02255EA0, 36 bytes long. Data: <Pö$ ÐP% XS% V% > 50 F6 24 02 D0 50 25 02 58 53 25 02 A0 56 25 02 strcore.cpp(118) : {56333} normal block at 0x02255F70, 36 bytes long. Data: < Retu> 01 00 00 00 17 00 00 00 17 00 00 00 52 65 74 75 strcore.cpp(118) : {56332} normal block at 0x02255F18, 26 bytes long. Data: < Move> 01 00 00 00 0D 00 00 00 0D 00 00 00 4D 6F 76 65 strcore.cpp(118) : {56330} normal block at 0x02255BB0, 23 bytes long. Data: < user> 01 00 00 00 0A 00 00 00 0A 00 00 00 75 73 65 72 C:\Program Files\Codejock Software\MFC\Xtreme ToolkitPro v12.1.1\Source\CommandBars\XTPControlButton.cpp(35) : {56329} client block at 0x02255CE8, subtype 0, 372 bytes long. a CXTPControlButton object at $02255CE8, 372 bytes long strcore.cpp(118) : {56328} normal block at 0x02255C80, 38 bytes long. Data: < Move> 01 00 00 00 19 00 00 00 19 00 00 00 4D 6F 76 65 strcore.cpp(118) : {56327} normal block at 0x02255C28, 24 bytes long. Data: < Next> 02 00 00 00 0B 00 00 00 0B 00 00 00 4E 65 78 74 strcore.cpp(118) : {56325} normal block at 0x022558C0, 23 bytes long. Data: < user> 01 00 00 00 0A 00 00 00 0A 00 00 00 75 73 65 72 C:\Program Files\Codejock Software\MFC\Xtreme ToolkitPro v12.1.1\Source\CommandBars\XTPControlButton.cpp(35) : {56324} client block at 0x022559F8, subtype 0, 372 bytes long. a CXTPControlButton object at $022559F8, 372 bytes long strcore.cpp(118) : {56323} normal block at 0x02255990, 36 bytes long. Data: < Sele> 01 00 00 00 17 00 00 00 17 00 00 00 53 65 6C 65 strcore.cpp(118) : {56322} normal block at 0x02255938, 24 bytes long. Data: < Sele> 01 00 00 00 0B 00 00 00 0B 00 00 00 53 65 6C 65 strcore.cpp(118) : {56319} normal block at 0x02255568, 23 bytes long. Data: < user> 01 00 00 00 0A 00 00 00 0A 00 00 00 75 73 65 72 C:\Program Files\Codejock Software\MFC\Xtreme ToolkitPro v12.1.1\Source\CommandBars\XTPControlButton.cpp(35) : {56318} client block at 0x022556A0, subtype 0, 372 bytes long. a CXTPControlButton object at $022556A0, 372 bytes long strcore.cpp(118) : {56315} normal block at 0x02255638, 42 bytes long. Data: < Move> 01 00 00 00 1D 00 00 00 1D 00 00 00 4D 6F 76 65 strcore.cpp(118) : {56314} normal block at 0x022555E0, 28 bytes long. Data: < Prev> 02 00 00 00 0F 00 00 00 0F 00 00 00 50 72 65 76 strcore.cpp(118) : {56312} normal block at 0x02255510, 23 bytes long. Data: < user> 01 00 00 00 0A 00 00 00 0A 00 00 00 75 73 65 72 C:\Program Files\Codejock Software\MFC\Xtreme ToolkitPro v12.1.1\Source\CommandBars\XTPControlButton.cpp(35) : {56311} client block at 0x02255358, subtype 0, 372 bytes long. a CXTPControlButton object at $02255358, 372 bytes long strcore.cpp(118) : {56309} normal block at 0x022552E0, 53 bytes long. Data: < ( ( Disp> 01 00 00 00 28 00 00 00 28 00 00 00 44 69 73 70 strcore.cpp(118) : {56308} normal block at 0x02255288, 19 bytes long. Data: < Lege> 02 00 00 00 06 00 00 00 06 00 00 00 4C 65 67 65 strcore.cpp(118) : {56306} normal block at 0x0224FF50, 23 bytes long. Data: < user> 01 00 00 00 0A 00 00 00 0A 00 00 00 75 73 65 72 C:\Program Files\Codejock Software\MFC\Xtreme ToolkitPro v12.1.1\Source\CommandBars\XTPControlButton.cpp(35) : {56305} client block at 0x022550D0, subtype 0, 372 bytes long. a CXTPControlButton object at $022550D0, 372 bytes long strcore.cpp(118) : {56303} normal block at 0x02255058, 54 bytes long. Data: < ) ) Sele> 01 00 00 00 29 00 00 00 29 00 00 00 53 65 6C 65 strcore.cpp(118) : {56302} normal block at 0x02255000, 25 bytes long. Data: < Disp> 02 00 00 00 0C 00 00 00 0C 00 00 00 44 69 73 70 C:\Program Files\Codejock Software\MFC\Xtreme ToolkitPro v12.1.1\Source\CommandBars\XTPCommandBar.cpp(200) : {56296} normal block at 0x0224FC48, 48 bytes long. Data: <Ðø$ âJ_ > D0 F8 24 02 88 E2 4A 5F 00 00 00 00 00 00 00 00 C:\Program Files\Codejock Software\MFC\Xtreme ToolkitPro v12.1.1\Source\CommandBars\XTPControls.cpp(51) : {56295} client block at 0x0224FBC0, subtype 0, 68 bytes long. a CXTPControls object at $0224FBC0, 68 bytes long strcore.cpp(118) : {56294} normal block at 0x0224FB68, 23 bytes long. Data: < user> 01 00 00 00 0A 00 00 00 0A 00 00 00 75 73 65 72 C:\Program Files\Codejock Software\MFC\Xtreme ToolkitPro v12.1.1\Source\CommandBars\XTPControlComboBox.cpp(477) : {56293} client block at 0x0224F8D0, subtype 0, 600 bytes long. a CXTPControlComboBoxList object at $0224F8D0, 600 bytes long strcore.cpp(118) : {56292} normal block at 0x0224F878, 23 bytes long. Data: < user> 01 00 00 00 0A 00 00 00 0A 00 00 00 75 73 65 72 C:\Program Files\Codejock Software\MFC\Xtreme ToolkitPro v12.1.1\Source\CommandBars\XTPControlComboBox.cpp(455) : {56291} client block at 0x0224F650, subtype 0, 480 bytes long. a CXTPControlComboBox object at $0224F650, 480 bytes long strcore.cpp(118) : {56286} normal block at 0x0224F2F8, 29 bytes long. Data: < Cale> 01 00 00 00 10 00 00 00 10 00 00 00 43 61 6C 65 C:\Program Files\Codejock Software\MFC\Xtreme ToolkitPro v12.1.1\Source\CommandBars\XTPToolBar.cpp(247) : {56285} normal block at 0x0224F260, 80 bytes long. Data: <$W_ ðï$ ÍÍÍÍ> 24 57 5F 01 F0 EF 24 02 00 00 00 00 CD CD CD CD C:\Program Files\Codejock Software\MFC\Xtreme ToolkitPro v12.1.1\Source\CommandBars\XTPCommandBar.cpp(200) : {56284} normal block at 0x0224F1E8, 48 bytes long. Data: <ðï$ âJ_ > F0 EF 24 02 88 E2 4A 5F 00 00 00 00 00 00 00 00 C:\Program Files\Codejock Software\MFC\Xtreme ToolkitPro v12.1.1\Source\CommandBars\XTPControls.cpp(51) : {56283} client block at 0x0225F2B8, subtype 0, 68 bytes long. a CXTPControls object at $0225F2B8, 68 bytes long strcore.cpp(118) : {56282} normal block at 0x01EFAB08, 23 bytes long. |
|
![]() |
Post Reply ![]() |
|
Tweet
|
Forum Jump | Forum Permissions ![]() You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |