USD: Release ImBuf objects during export
ImBuf objects need to be released after they are acquired. Would cause a memory leak otherwise. Pull Request: https://projects.blender.org/blender/blender/pulls/107361
This commit is contained in:
committed by
Jesse Yurkovich
parent
38ad653d77
commit
d36af92e5f
@@ -17,6 +17,7 @@
|
||||
#include "BLI_linklist.h"
|
||||
#include "BLI_listbase.h"
|
||||
#include "BLI_math.h"
|
||||
#include "BLI_memory_utils.hh"
|
||||
#include "BLI_path_util.h"
|
||||
#include "BLI_string.h"
|
||||
|
||||
@@ -378,6 +379,7 @@ static std::string get_in_memory_texture_filename(Image *ima)
|
||||
|
||||
ImageFormatData imageFormat;
|
||||
BKE_image_format_from_imbuf(&imageFormat, imbuf);
|
||||
BKE_image_release_ibuf(ima, imbuf, nullptr);
|
||||
|
||||
char file_name[FILE_MAX];
|
||||
/* Use the image name for the file name. */
|
||||
@@ -405,6 +407,7 @@ static void export_in_memory_texture(Image *ima,
|
||||
}
|
||||
|
||||
ImBuf *imbuf = BKE_image_acquire_ibuf(ima, nullptr, nullptr);
|
||||
BLI_SCOPED_DEFER([&]() { BKE_image_release_ibuf(ima, imbuf, nullptr); });
|
||||
if (!imbuf) {
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user