Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/supermerill/SuperSlicer.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbubnikv <bubnikv@gmail.com>2019-12-20 19:29:23 +0300
committerbubnikv <bubnikv@gmail.com>2019-12-20 19:29:30 +0300
commita0d47bf1674849464e77b0dbff291d176632e19d (patch)
tree9d395dafcef6c6667835ff213fdcef1ae69d261f
parentcf0697b5f2aea269686df106639ef04818f0f370 (diff)
Fixed a file handle leak.
-rw-r--r--src/slic3r/GUI/wxExtensions.cpp20
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;
}