From 6b9910ac8c4a854c9dd1960471979c3470daa4c6 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Tue, 11 Nov 2014 00:59:13 +0000 Subject: [PATCH] Fix size of the icon returned from wxFSVolume::GetIcon(). Calling SetHICON() is not enough, the icon size already needs to be set or, even better, CreateFromHICON(), which does both atomically, should be used. Closes #16672. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_3_0_BRANCH@78122 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- docs/changes.txt | 1 + src/msw/volume.cpp | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/docs/changes.txt b/docs/changes.txt index 5ab0e195d7..c0cb9f31f1 100644 --- a/docs/changes.txt +++ b/docs/changes.txt @@ -594,6 +594,7 @@ wxMSW: - Fix best height of wxSlider with labels but without ticks (Artur Wieczorek). - Fix initial text value of wxSpinCtrlDouble (Laurent Poujoulat). - Fix best size calculation for bitmaps with buttons (Artur Wieczorek). +- Fix size of the icon returned from wxFSVolume::GetIcon() (troelsk). 3.0.2: (released 2014-10-06) diff --git a/src/msw/volume.cpp b/src/msw/volume.cpp index 2b38bc7310..eb639084f4 100644 --- a/src/msw/volume.cpp +++ b/src/msw/volume.cpp @@ -614,11 +614,14 @@ wxIcon wxFSVolume::GetIcon(wxFSIconType type) const SHFILEINFO fi; long rc = SHGetFileInfo(m_volName.t_str(), 0, &fi, sizeof(fi), flags); - m_icons[type].SetHICON((WXHICON)fi.hIcon); if (!rc || !fi.hIcon) { wxLogError(_("Cannot load icon from '%s'."), m_volName.c_str()); } + else + { + m_icons[type].CreateFromHICON((WXHICON)fi.hIcon); + } } return m_icons[type];