mirror of
				https://github.com/SoftFever/OrcaSlicer.git
				synced 2025-11-02 20:51:23 -07:00 
			
		
		
		
	Fixed crash on removable device plug in event due to recent
RemovableDriveManager refactoring.
This commit is contained in:
		
							parent
							
								
									2363f2a4a3
								
							
						
					
					
						commit
						5052ef88db
					
				
					 1 changed files with 2 additions and 3 deletions
				
			
		| 
						 | 
				
			
			@ -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());
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue