Unlock and destroy converted surface before error is thrown
This commit is contained in:
parent
350c0bef08
commit
101c4327cc
1 changed files with 4 additions and 1 deletions
|
|
@ -215,9 +215,12 @@ void InputManager::get_clipboard_image_data_SDL(const std::function<void(std::st
|
||||||
SDL_DestroySurface(cSurf);
|
SDL_DestroySurface(cSurf);
|
||||||
result = out.detachAsVector();
|
result = out.detachAsVector();
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
|
SDL_UnlockSurface(cSurf);
|
||||||
|
SDL_DestroySurface(cSurf);
|
||||||
throw std::runtime_error("Could not encode image data to PNG");
|
throw std::runtime_error("Could not encode image data to PNG");
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
throw std::runtime_error("Bitmap could not be converted to new format");
|
throw std::runtime_error("Bitmap could not be converted to new format");
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue