QTiffHandler: replace manual memory mgmt with unique_ptr [1/N]: write() and openInternal()
The write() function, in particular, was such a C-style tangle of
TIFFClose() calls in front of every early return (of which there are
many!) that I couldn't help myself porting to unique_ptr.
Yes, the impedance mismatch between a unique_ptr and C APIs is rather
large, but the memory safety gained trumps that. Besides, two prequel
refactorings have dealt with the bulk of the changes by centralizing
the access to the pointer in two lambda local to write().
Keep Private::tiff as a raw pointer for now to keep the commit small
for ease of review. Consequently, we need to release() into it in
openForRead().
Amends the move of the TIFF plugin from qtbase to to qtimageformats,
from qtbase (5.0). Granted, that didn't have C++11 unique_ptr, yet,
but it did have Qt QScopedPointer and C++98 std::auto_ptr.
Picking to all active branches to keep the way free for any security
updates that follow.
Pick-to: 6.12 6.11 6.8
Change-Id: I6ea3566ec7a9d4f3edf12efb7d43c23d5dde1808
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>