From b68853ae627697b7ab7319cc073420edb1ae9e35 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Va=CC=81clav=20Slavi=CC=81k?= Date: Mon, 6 Feb 2017 12:57:54 +0100 Subject: [PATCH] Fix wxIconBundle::GetIcon(wxDefaultSize) in wxOSX GetIcon() relies on wxSYS_ICON_X/Y to determine the size to return if it isn't specified and FALLBACK_SYSTEM is used. But wxSYS_ICON_X/Y is not implemented in many ports and this code fails. If wxSYS_ICON_X is -1, usea reasonable default that is the same as other platforms use (32) and also add FALLBACK_NEAREST_LARGER to allow picking some other size if 32x32 isn't available. Doing this fixes an assert in wxLogDialog on macOS if a non-native art provider (such as Tango) isn't available. --- src/common/iconbndl.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/common/iconbndl.cpp b/src/common/iconbndl.cpp index c4563120fb..566f1ae813 100644 --- a/src/common/iconbndl.cpp +++ b/src/common/iconbndl.cpp @@ -215,6 +215,14 @@ wxIcon wxIconBundle::GetIcon(const wxSize& size, int flags) const sizeX = sysX; sizeY = sysY; + + // Not all ports provide this metric, so if they don't, fall back to + // something reasonable _and_ allow searching for a closer match. + if ( sizeX == -1 && sizeY == -1 ) + { + sizeX = sizeY = 32; + flags |= FALLBACK_NEAREST_LARGER; + } } // Iterate over all icons searching for the exact match or the closest icon