Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
authorNicholas Bishop <nicholasbishop@gmail.com>2015-02-09 14:02:59 +0300
committerNicholas Bishop <nicholasbishop@gmail.com>2015-02-09 14:02:59 +0300
commit5544ded2b513a41caa1673aea3dfbbc5b56380be (patch)
treeb4ad7ff0afd0de0e79af357d492c0cd42c543673 /source
parent567e147f619b1a51eecebccaaff39030362fd2f4 (diff)
Fix ImBuf leaked by Image from View operator
Running this operator and and closing Blender gives this: Error: Not freed memory blocks: 2 ImBuf_struct len: 2480 0x69ba4f8 imb_addrectImBuf len: 1048576 0x6ccc2d8 Fixed with added call to IMB_freeImBuf in BKE_image_add_from_imbuf. Could be fixed in the operator instead, but I think the BKE function is the correct place since the comment says it should take ownership of the ImBuf. Reviewers: sergey Reviewed By: sergey Differential Revision: https://developer.blender.org/D1084
Diffstat (limited to 'source')
-rw-r--r--source/blender/blenkernel/intern/image.c4
-rw-r--r--source/blender/editors/sculpt_paint/paint_image_proj.c3
2 files changed, 6 insertions, 1 deletions
diff --git a/source/blender/blenkernel/intern/image.c b/source/blender/blenkernel/intern/image.c
index 748d0d10d4a..131a19b8108 100644
--- a/source/blender/blenkernel/intern/image.c
+++ b/source/blender/blenkernel/intern/image.c
@@ -803,7 +803,9 @@ Image *BKE_image_add_generated(Main *bmain, unsigned int width, unsigned int hei
return ima;
}
-/* creates an image image owns the imbuf passed */
+/* Create an image image from ibuf. The refcount of ibuf is increased,
+ * caller should take care to drop its reference by calling
+ * IMB_freeImBuf if needed. */
Image *BKE_image_add_from_imbuf(ImBuf *ibuf)
{
/* on save, type is changed to FILE in editsima.c */
diff --git a/source/blender/editors/sculpt_paint/paint_image_proj.c b/source/blender/editors/sculpt_paint/paint_image_proj.c
index ff82688def8..098477ed2a1 100644
--- a/source/blender/editors/sculpt_paint/paint_image_proj.c
+++ b/source/blender/editors/sculpt_paint/paint_image_proj.c
@@ -5136,6 +5136,9 @@ static int texture_paint_image_from_view_exec(bContext *C, wmOperator *op)
image = BKE_image_add_from_imbuf(ibuf);
+ /* Drop reference to ibuf so that the image owns it */
+ IMB_freeImBuf(ibuf);
+
if (image) {
/* now for the trickyness. store the view projection here!
* re-projection will reuse this */