Fix potential crash when buffers are destroyed
Fix potential crash when buffers are destroyed

Also remove non-optimization.

Change-Id: Ic5903efffc064eb1ef0d46ef72231e726270af47
Reviewed-by: Jørgen Lind <6105bb7d7ebdd613cef5835c4a38d29949bd95ac@nokia.com>

ntanibata/qtwayland,ntanibata/qtwayland,Tofee/qtwayland,Tofee/qtwayland,locusf/qtwayland-1,locusf/qtwayland-1,locusf/qtwayland-1,locusf/qtwayland-1,ntanibata/qtwayland,Tofee/qtwayland