QSvgHandler: fix unintended copy in createImageNode()
Coverity complained that 'filename' was copied when it could have been
moved.
This is correct, but not trivial to understand: If, in a ternary
expression, one of the legs is an rvalue and the other is an lvalue,
then the ternary expression is also an rvalue.
But, of course, the lvalue isn't being moved from in this case.
Instead, lvalue-to-rvalue conversion materializes a temporary QString
as a copy of the lvalue, and _that_ is moved instead. This is what
happens with 'filename' and why Coverity complains about a copy. It's
the copy into the materialized temporary.
Note that this is purely due to the use of the ternary: if we were to
pass QString() and filename alone, each one would not be copied.
See qtbase/cd96362492375c50a9d0614b829c51eb6597d713 for a similar
issue and fix.
To fix, reset filename to isNull() when we don't need it. Assign a
QString() instead of saying clear(), because the latter may keep
capacity() around, which we don't need nor want to be pinned in the
(potentially) long-running QSvgImageNode.
Amends 59bbe94c2117d34290e0462876c39d08a6661961 (6.8).
Apart from a Coverity issue that both Robert Löhning and I agree looks
very much like a False Positive (in what is now parseFontStyle(), so
the refactoring may make it just go away, we'll see), this was the
last Coverity issue in this module! Here's to no further ones *clink*
Pick-to: 6.11 6.8
Coverity-Id: 460317
Change-Id: I8ae980f8ca2d08318d3d755d6cb51410fcce41dc
Reviewed-by: Hatem ElKharashy <hatem.elkharashy@qt.io>