diff options
author | B Stack <bgstack15@gmail.com> | 2018-10-17 02:11:26 +0000 |
---|---|---|
committer | B Stack <bgstack15@gmail.com> | 2018-10-17 02:11:26 +0000 |
commit | f70f8f961ef8f4d909266f71310e3515f25928e6 (patch) | |
tree | 89b2a018482c164bdd8ecac5c76b19a08f420dec /wx+/image_resources.cpp | |
parent | Merge branch '10.4' into 'master' (diff) | |
parent | 10.5 (diff) | |
download | FreeFileSync-f70f8f961ef8f4d909266f71310e3515f25928e6.tar.gz FreeFileSync-f70f8f961ef8f4d909266f71310e3515f25928e6.tar.bz2 FreeFileSync-f70f8f961ef8f4d909266f71310e3515f25928e6.zip |
Merge branch '10.5' into 'master'10.5
10.5
See merge request opensource-tracking/FreeFileSync!2
Diffstat (limited to 'wx+/image_resources.cpp')
-rwxr-xr-x | wx+/image_resources.cpp | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/wx+/image_resources.cpp b/wx+/image_resources.cpp index d0449fe5..d09a188b 100755 --- a/wx+/image_resources.cpp +++ b/wx+/image_resources.cpp @@ -122,14 +122,12 @@ public: result_.access([&](std::vector<std::pair<std::wstring, ImageHolder>>& r) { - for (auto& item : r) + for (auto& [imageName, ih] : r) { - ImageHolder& ih = item.second; - wxImage img(ih.getWidth(), ih.getHeight(), ih.releaseRgb(), false /*static_data*/); //pass ownership img.SetAlpha(ih.releaseAlpha(), false /*static_data*/); - output.emplace(item.first, std::move(img)); + output.emplace(imageName, std::move(img)); } }); return output; @@ -171,7 +169,8 @@ class GlobalBitmaps public: static std::shared_ptr<GlobalBitmaps> instance() { - static Global<GlobalBitmaps> inst(std::make_unique<GlobalBitmaps>()); + static FunStatGlobal<GlobalBitmaps> inst; + inst.initOnce([] { return std::make_unique<GlobalBitmaps>(); }); assert(runningMainThread()); //wxWidgets is not thread-safe! return inst.get(); } @@ -179,7 +178,7 @@ public: GlobalBitmaps() {} ~GlobalBitmaps() { assert(bitmaps_.empty() && anims_.empty()); } //don't leave wxWidgets objects for static destruction! - void init(const Zstring& filepath); + void init(const Zstring& filePath); void cleanup() { bitmaps_.clear(); @@ -239,6 +238,8 @@ void GlobalBitmaps::init(const Zstring& filePath) } else if (endsWith(name, L".gif")) loadAnimFromZip(streamIn, anims_[name]); + else + assert(false); } } } |