Author: cwittich Date: Tue Feb 12 21:49:20 2008 New Revision: 32329
URL: http://svn.reactos.org/svn/reactos?rev=32329&view=rev Log: fix some memory and resource leaks fixes by janderwald and myself
Modified: trunk/reactos/base/shell/explorer/desktop/desktop.cpp trunk/reactos/base/shell/explorer/explorer.cpp trunk/reactos/base/shell/explorer/globals.h trunk/reactos/base/shell/explorer/shell/entries.cpp
Modified: trunk/reactos/base/shell/explorer/desktop/desktop.cpp URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/shell/explorer/desktop... ============================================================================== --- trunk/reactos/base/shell/explorer/desktop/desktop.cpp (original) +++ trunk/reactos/base/shell/explorer/desktop/desktop.cpp Tue Feb 12 21:49:20 2008 @@ -837,11 +837,11 @@
// use a little trick to get the icons where we want them to be...
- for(IconMap::const_iterator it=pos_idx.end(); --it!=pos_idx.begin(); ) { - const IconPos& pos = it->first; - - ListView_SetItemPosition32(_hwndListView, it->second, pos.second, pos.first); - } + //for(IconMap::const_iterator it=pos_idx.end(); --it!=pos_idx.begin(); ) { + // const IconPos& pos = it->first; + + // ListView_SetItemPosition32(_hwndListView, it->second, pos.second, pos.first); + //}
for(IconMap::const_iterator it=pos_idx.begin(); it!=pos_idx.end(); ++it) { const IconPos& pos = it->first;
Modified: trunk/reactos/base/shell/explorer/explorer.cpp URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/shell/explorer/explore... ============================================================================== --- trunk/reactos/base/shell/explorer/explorer.cpp (original) +++ trunk/reactos/base/shell/explorer/explorer.cpp Tue Feb 12 21:49:20 2008 @@ -227,6 +227,10 @@ // hide some file extensions if (type._neverShowExt && !dont_hide_ext) { int len = ext - entry->_data.cFileName; + + if (entry->_display_name != entry->_data.cFileName) + free(entry->_display_name); + entry->_display_name = (LPTSTR) malloc((len+1)*sizeof(TCHAR)); lstrcpyn(entry->_display_name, entry->_data.cFileName, len + 1); } @@ -627,6 +631,26 @@ return _icons[id]; }
+IconCache::~IconCache() +{ + for (int index = s_next_id; index >= 0; index--) + { + IconMap::iterator found = _icons.find(index); + + if (found != _icons.end()) + { + Icon& icon = found->second; + + if ((icon.get_icontype() == IT_DYNAMIC) || + (icon.get_icontype() == IT_CACHED)) + { + DestroyIcon(icon.get_hicon()); + _icons.erase(found); + } + } + } +} + void IconCache::free_icon(int icon_id) { IconMap::iterator found = _icons.find(icon_id);
Modified: trunk/reactos/base/shell/explorer/globals.h URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/shell/explorer/globals... ============================================================================== --- trunk/reactos/base/shell/explorer/globals.h (original) +++ trunk/reactos/base/shell/explorer/globals.h Tue Feb 12 21:49:20 2008 @@ -108,6 +108,7 @@
int get_sysiml_idx() const {return _itype==IT_SYSCACHE? _sys_idx: -1;} HICON get_hicon() const {return _itype!=IT_SYSCACHE? _hicon: 0;} + ICON_TYPE get_icontype() const { return _itype; }
bool destroy() {if (_itype == IT_DYNAMIC) {DestroyIcon(_hicon); return true;} else return false;}
@@ -126,6 +127,7 @@ struct IconCache { IconCache() : _himlSys_small(0) {}
+ virtual ~IconCache(); void init();
const Icon& extract(LPCTSTR path, ICONCACHE_FLAGS flags=ICF_NORMAL);
Modified: trunk/reactos/base/shell/explorer/shell/entries.cpp URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/shell/explorer/shell/e... ============================================================================== --- trunk/reactos/base/shell/explorer/shell/entries.cpp (original) +++ trunk/reactos/base/shell/explorer/shell/entries.cpp Tue Feb 12 21:49:20 2008 @@ -107,6 +107,9 @@
if (_content) free(_content); + + if (_down) + delete _down; }