mirror of
https://bitbucket.org/smil3y/katie.git
synced 2025-02-24 02:42:55 +00:00
do not copy the variant before checking if it can be converted in QVariant::canConvert()
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
parent
74fef30990
commit
4acfa93e66
1 changed files with 9 additions and 6 deletions
|
@ -2669,19 +2669,22 @@ bool QVariant::convert(Type t)
|
|||
if (d.type == int(t))
|
||||
return true;
|
||||
|
||||
if (!canConvert(t)) {
|
||||
clear();
|
||||
return false;
|
||||
}
|
||||
|
||||
QVariant oldValue = *this;
|
||||
|
||||
clear();
|
||||
if (!oldValue.canConvert(t))
|
||||
return false;
|
||||
|
||||
create(t, nullptr);
|
||||
if (oldValue.isNull())
|
||||
if (oldValue.isNull()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
bool isOk = true;
|
||||
if (!handler->convert(&oldValue.d, t, data(), &isOk))
|
||||
if (!handler->convert(&oldValue.d, t, data(), &isOk)) {
|
||||
isOk = false;
|
||||
}
|
||||
d.is_null = !isOk;
|
||||
return isOk;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue