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>2020-03-07 12:17:58 +0300
committerbubnikv <bubnikv@gmail.com>2020-03-07 12:17:58 +0300
commit5052ef88db0a38e2bde638d1164220e930b0c527 (patch)
tree7565e9c305b870e2b2969b9ae1822a1d586e67ca /src/slic3r/GUI/RemovableDriveManager.cpp
parent2363f2a4a32e9be7b94b3ad0862d85c1821cb823 (diff)
Fixed crash on removable device plug in event due to recent
RemovableDriveManager refactoring.
Diffstat (limited to 'src/slic3r/GUI/RemovableDriveManager.cpp')
-rw-r--r--src/slic3r/GUI/RemovableDriveManager.cpp5
1 files changed, 2 insertions, 3 deletions
diff --git a/src/slic3r/GUI/RemovableDriveManager.cpp b/src/slic3r/GUI/RemovableDriveManager.cpp
index c97a745af..a363d8ae8 100644
--- a/src/slic3r/GUI/RemovableDriveManager.cpp
+++ b/src/slic3r/GUI/RemovableDriveManager.cpp
@@ -37,10 +37,7 @@ std::vector<DriveData> RemovableDriveManager::search_for_removable_drives() cons
// Allocate the buffers before the loop.
std::wstring volume_name;
- volume_name.resize(MAX_PATH + 1);
std::wstring file_system_name;
- file_system_name.resize(MAX_PATH + 1);
-
// Iterate the Windows drives from 'A' to 'Z'
std::vector<DriveData> current_drives;
for (size_t i = 0; i < 26; ++ i)
@@ -51,6 +48,8 @@ std::vector<DriveData> RemovableDriveManager::search_for_removable_drives() cons
if (drive_type == DRIVE_REMOVABLE) {
// get name of drive
std::wstring wpath = boost::nowide::widen(path);
+ volume_name.resize(MAX_PATH + 1);
+ file_system_name.resize(MAX_PATH + 1);
BOOL error = ::GetVolumeInformationW(wpath.c_str(), volume_name.data(), sizeof(volume_name), nullptr, nullptr, nullptr, file_system_name.data(), sizeof(file_system_name));
if (error != 0) {
volume_name.erase(volume_name.begin() + wcslen(volume_name.c_str()), volume_name.end());