fixed memory leak
authorDavid Surovell <davids@osafoundation.org>
Tue, 22 Nov 2005 16:15:46 +0000 (16:15 +0000)
committerDavid Surovell <davids@osafoundation.org>
Tue, 22 Nov 2005 16:15:46 +0000 (16:15 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@36227 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/msw/tbar95.cpp

index 1da408f33b1e8e4abc1260b1ef83a2e53affb638..8e32ae39ed584469cf7ae12f423df405e4121d27 100644 (file)
@@ -509,6 +509,12 @@ bool wxToolBar::DoDeleteTool(size_t pos, wxToolBarToolBase *tool)
 
 void wxToolBar::CreateDisabledImageList()
 {
+    if (m_disabledImgList != NULL)
+    {
+        delete m_disabledImgList;
+        m_disabledImgList = NULL;
+    }
+
     // as we can't use disabled image list with older versions of comctl32.dll,
     // don't even bother creating it
     if ( wxTheApp->GetComCtl32Version() >= 470 )
@@ -528,14 +534,12 @@ void wxToolBar::CreateDisabledImageList()
                                             bmpDisabled.GetMask() != NULL,
                                             GetToolsCount()
                                         );
-                return;
+                break;
             }
         }
 
         // we don't have any disabled bitmaps
     }
-
-    m_disabledImgList = NULL;
 }
 
 bool wxToolBar::Realize()
@@ -631,8 +635,6 @@ bool wxToolBar::Realize()
                 totalBitmapWidth, totalBitmapHeight);
 
             dcAllButtons.SelectObject(bitmap);
-
-
         }
 #endif // !__WXWINCE__
 
@@ -726,8 +728,6 @@ bool wxToolBar::Realize()
             // Map to system colours
             hBitmap = (HBITMAP)MapBitmap((WXHBITMAP) hBitmap,
                 totalBitmapWidth, totalBitmapHeight);
-
-
         }
 
         bool addBitmap = true;