fix heap corruption due to invalid static_cast
This commit is contained in:
@@ -23,6 +23,7 @@
|
||||
#include "PreCompiled.h"
|
||||
|
||||
#ifndef _PreComp_
|
||||
# include <QDebug>
|
||||
# include <QTextStream>
|
||||
#endif
|
||||
|
||||
@@ -44,6 +45,10 @@ PropertyConstraintListItem::PropertyConstraintListItem()
|
||||
onlyUnnamed = false;
|
||||
}
|
||||
|
||||
PropertyConstraintListItem::~PropertyConstraintListItem()
|
||||
{
|
||||
}
|
||||
|
||||
QVariant PropertyConstraintListItem::toString(const QVariant& prop) const
|
||||
{
|
||||
const QList<Base::Quantity>& value = prop.value< QList<Base::Quantity> >();
|
||||
@@ -175,10 +180,17 @@ QVariant PropertyConstraintListItem::value(const App::Property* prop) const
|
||||
if ((*it)->Name.empty() && !onlyUnnamed) {
|
||||
onlyNamed = false;
|
||||
subquantities.append(quant);
|
||||
PropertyConstraintListItem* unnamednode = static_cast<PropertyConstraintListItem*>(self->child(self->childCount()-1));
|
||||
unnamednode->blockEvent = true;
|
||||
unnamednode->setProperty(internalName.toLatin1(), QVariant::fromValue<Base::Quantity>(quant));
|
||||
unnamednode->blockEvent = false;
|
||||
PropertyItem* child = self->child(self->childCount()-1);
|
||||
PropertyConstraintListItem* unnamednode = qobject_cast<PropertyConstraintListItem*>(child);
|
||||
if (unnamednode) {
|
||||
unnamednode->blockEvent = true;
|
||||
unnamednode->setProperty(internalName.toLatin1(), QVariant::fromValue<Base::Quantity>(quant));
|
||||
unnamednode->blockEvent = false;
|
||||
}
|
||||
else {
|
||||
qWarning() << "Item is not of type PropertyConstraintListItem but"
|
||||
<< typeid(*child).name();
|
||||
}
|
||||
}
|
||||
else {
|
||||
self->setProperty(internalName.toLatin1(), QVariant::fromValue<Base::Quantity>(quant));
|
||||
|
||||
@@ -45,6 +45,7 @@ class PropertyConstraintListItem: public Gui::PropertyEditor::PropertyItem
|
||||
Q_OBJECT
|
||||
PROPERTYITEM_HEADER
|
||||
|
||||
virtual ~PropertyConstraintListItem();
|
||||
virtual QWidget* createEditor(QWidget* parent, const QObject* receiver, const char* method) const;
|
||||
virtual void setEditorData(QWidget *editor, const QVariant& data) const;
|
||||
virtual QVariant editorData(QWidget *editor) const;
|
||||
|
||||
Reference in New Issue
Block a user