lock and unlock the image properly.

This commit is contained in:
Relintai 2021-12-12 18:00:56 +01:00
parent be575f2917
commit 17955723c3

View File

@ -4539,6 +4539,7 @@ void RTileSetAtlasSource::_update_padded_texture() {
Ref<Image> image; Ref<Image> image;
image.instance(); image.instance();
image->create(size.x, size.y, false, Image::FORMAT_RGBA8); image->create(size.x, size.y, false, Image::FORMAT_RGBA8);
image->lock();
for (const Map<Vector2i, TileAlternativesData>::Element *kv = tiles.front(); kv; kv = kv->next()) { for (const Map<Vector2i, TileAlternativesData>::Element *kv = tiles.front(); kv; kv = kv->next()) {
for (int frame = 0; frame < (int)kv->value().animation_frames_durations.size(); frame++) { for (int frame = 0; frame < (int)kv->value().animation_frames_durations.size(); frame++) {
@ -4568,6 +4569,8 @@ void RTileSetAtlasSource::_update_padded_texture() {
} }
} }
image->unlock();
if (!padded_texture.is_valid()) { if (!padded_texture.is_valid()) {
padded_texture.instance(); padded_texture.instance();
} }