Fix potential crash with too big shift for a label.

This commit is contained in:
Roman Telezhynskyi 2020-11-07 15:14:46 +02:00
parent 99985d43e0
commit e5a9092e25
5 changed files with 7 additions and 13 deletions

View File

@ -94,8 +94,6 @@ DestinationItem VAbstractFlipping::CreateItem(quint32 idTool, const SourceItem &
}
DestinationItem item;
item.mx = INT_MAX;
item.my = INT_MAX;
item.id = data->AddGObject(new Item(rotated));
return item;
}

View File

@ -252,8 +252,8 @@ QVector<DestinationItem> VAbstractOperation::ExtractDestinationData(const QDomEl
{
DestinationItem d;
d.id = VDomDocument::GetParametrUInt(element, AttrIdObject, NULL_ID_STR);
d.mx = qApp->toPixel(VDomDocument::GetParametrDouble(element, AttrMx, QString::number(INT_MAX)));
d.my = qApp->toPixel(VDomDocument::GetParametrDouble(element, AttrMy, QString::number(INT_MAX)));
d.mx = qApp->toPixel(VDomDocument::GetParametrDouble(element, AttrMx, QChar('1')));
d.my = qApp->toPixel(VDomDocument::GetParametrDouble(element, AttrMy, QChar('1')));
d.showLabel = VDomDocument::GetParametrBool(element, AttrShowLabel, trueStr);
destination.append(d);
}
@ -754,7 +754,7 @@ void VAbstractOperation::SaveSourceDestination(QDomElement &tag)
QDomElement item = doc->createElement(TagItem);
doc->SetAttribute(item, AttrIdObject, dItem.id);
VAbstractSimple *obj = operatedObjects.value(dItem.id);
VAbstractSimple *obj = operatedObjects.value(dItem.id, nullptr);
doc->SetAttributeOrRemoveIf(item, AttrMx, qApp->fromPixel(dItem.mx),
obj && obj->GetType() != GOType::Point);

View File

@ -45,10 +45,10 @@
struct DestinationItem
{
quint32 id;
qreal mx;
qreal my;
bool showLabel;
quint32 id{NULL_ID};
qreal mx{1};
qreal my{1};
bool showLabel{true};
};
struct VAbstractOperationInitData : VDrawToolInitData

View File

@ -629,8 +629,6 @@ DestinationItem VToolMove::CreateItem(quint32 idTool, const SourceItem &sItem, q
}
DestinationItem item;
item.mx = INT_MAX;
item.my = INT_MAX;
item.id = data->AddGObject(new Item(moved));
return item;
}

View File

@ -440,8 +440,6 @@ DestinationItem VToolRotation::CreateItem(quint32 idTool, const SourceItem &sIte
}
DestinationItem item;
item.mx = INT_MAX;
item.my = INT_MAX;
item.id = data->AddGObject(new Item(rotated));
return item;
}