From e152e0c2bea918a7e117bf844640bed26ee5c9df Mon Sep 17 00:00:00 2001 From: Andrzej Kapolka Date: Thu, 21 Aug 2014 15:22:34 -0700 Subject: [PATCH] Detachment fix. --- interface/src/ui/MetavoxelEditor.cpp | 4 +++- libraries/metavoxels/src/SharedObject.cpp | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/interface/src/ui/MetavoxelEditor.cpp b/interface/src/ui/MetavoxelEditor.cpp index 3ca509cd95..ce09e3657d 100644 --- a/interface/src/ui/MetavoxelEditor.cpp +++ b/interface/src/ui/MetavoxelEditor.cpp @@ -1188,7 +1188,9 @@ QVariant HeightfieldTextureBrushTool::createEdit(bool alternate) { if (alternate) { return QVariant::fromValue(PaintHeightfieldTextureEdit(_position, _radius->value(), SharedObjectPointer(), QColor())); } else { - return QVariant::fromValue(PaintHeightfieldTextureEdit(_position, _radius->value(), _textureEditor->getObject(), + SharedObjectPointer texture = _textureEditor->getObject(); + _textureEditor->detachObject(); + return QVariant::fromValue(PaintHeightfieldTextureEdit(_position, _radius->value(), texture, _texture ? _texture->getAverageColor() : QColor())); } } diff --git a/libraries/metavoxels/src/SharedObject.cpp b/libraries/metavoxels/src/SharedObject.cpp index c125e1352b..bf9b123a36 100644 --- a/libraries/metavoxels/src/SharedObject.cpp +++ b/libraries/metavoxels/src/SharedObject.cpp @@ -193,7 +193,9 @@ void SharedObjectEditor::detachObject() { for (int i = 0; i < form->rowCount(); i++) { QWidget* widget = form->itemAt(i, QFormLayout::FieldRole)->widget(); QMetaProperty property = metaObject->property(widget->property("propertyIndex").toInt()); - connect(_object.data(), signal(property.notifySignal().methodSignature()), SLOT(updateProperty())); + if (property.hasNotifySignal()) { + connect(_object.data(), signal(property.notifySignal().methodSignature()), SLOT(updateProperty())); + } } }