Unlock and destroy converted surface before error is thrown

This commit is contained in:
Yousef Khadadeh 2026-01-12 15:08:22 +03:00
parent 350c0bef08
commit 101c4327cc

View file

@ -215,8 +215,11 @@ void InputManager::get_clipboard_image_data_SDL(const std::function<void(std::st
SDL_DestroySurface(cSurf);
result = out.detachAsVector();
}
else
else {
SDL_UnlockSurface(cSurf);
SDL_DestroySurface(cSurf);
throw std::runtime_error("Could not encode image data to PNG");
}
}
else
throw std::runtime_error("Bitmap could not be converted to new format");