diff options
author | bubnikv <bubnikv@gmail.com> | 2019-12-20 19:29:23 +0300 |
---|---|---|
committer | bubnikv <bubnikv@gmail.com> | 2019-12-20 19:29:30 +0300 |
commit | a0d47bf1674849464e77b0dbff291d176632e19d (patch) | |
tree | 9d395dafcef6c6667835ff213fdcef1ae69d261f | |
parent | cf0697b5f2aea269686df106639ef04818f0f370 (diff) |
Fixed a file handle leak.
-rw-r--r-- | src/slic3r/GUI/wxExtensions.cpp | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/src/slic3r/GUI/wxExtensions.cpp b/src/slic3r/GUI/wxExtensions.cpp index 7c63e96c6..ad74e0ea0 100644 --- a/src/slic3r/GUI/wxExtensions.cpp +++ b/src/slic3r/GUI/wxExtensions.cpp @@ -433,17 +433,15 @@ static std::string icon_name_respected_to_mode(const std::string& bmp_name_in) #else const std::string folder = "white/"; #endif - std::string bmp_name = Slic3r::GUI::wxGetApp().dark_mode() ? folder + bmp_name_in : bmp_name_in; - boost::replace_last(bmp_name, ".png", ""); - FILE* fp = NULL; - fp = boost::nowide::fopen(Slic3r::var(bmp_name + ".svg").c_str(), "rb"); - if (!fp) - { - bmp_name = bmp_name_in; - boost::replace_last(bmp_name, ".png", ""); - if (fp) fclose(fp); - } - + std::string bmp_name; + if (Slic3r::GUI::wxGetApp().dark_mode()) { + bmp_name = folder + bmp_name_in; + boost::replace_last(bmp_name, ".png", ""); + } + if (bmp_name.empty()) { + bmp_name = bmp_name_in; + boost::replace_last(bmp_name, ".png", ""); + } return bmp_name; } |