Page MenuHome

Fix ImBuf leaked by Image from View operator
ClosedPublic

Authored by Nicholas Bishop (nicholasbishop) on Feb 8 2015, 11:18 PM.

Details

Summary

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.

Diff Detail

Repository
rB Blender
Branch
arcpatch-D1084-3

Event Timeline

Nicholas Bishop (nicholasbishop) retitled this revision from to Fix ImBuf leaked by Image from View operator.
Sergey Sharybin (sergey) requested changes to this revision.Feb 9 2015, 10:02 AM
Sergey Sharybin (sergey) edited edge metadata.

Don't think it's the proper way to go. BKE_image_add_from_imbuf() should in fact increase refcount of imbuf and if callee function doesn't need imbuf it need to explicitly dereference it.

The comment needs an adjustment as well it seems.

This revision now requires changes to proceed.Feb 9 2015, 10:02 AM
Nicholas Bishop (nicholasbishop) edited edge metadata.

Updated to deref in the operator as suggested, also updated comment

Grr that diff is clearly not right

Nicholas Bishop (nicholasbishop) edited edge metadata.

Hopefully fix diff, I clearly don't know how to use Arc

Sergey Sharybin (sergey) edited edge metadata.
This revision is now accepted and ready to land.Feb 9 2015, 11:55 AM
This revision was automatically updated to reflect the committed changes.