Removed all occasions where references to DataHandles were used, since...

Removed all occasions where references to DataHandles were used, since especially their use in signals may lead to segfaults or other undesired behavior.
parent 4700bbba
......@@ -150,7 +150,7 @@ namespace campvis {
* \param name Name of the added data.
* \param dh DataHandle to the newly added data.
*/
void onDataContainerDataAdded(const std::string& name, const DataHandle& dh);
void onDataContainerDataAdded(const std::string& name, DataHandle dh);
/**
* Slot getting called when one of the observed properties changed and notifies its observers.
......
......@@ -115,7 +115,7 @@ namespace campvis {
return _dataContainer;
}
void DataContainerInspectorWidget::onDataContainerDataAdded(const std::string& key, const DataHandle& dh) {
void DataContainerInspectorWidget::onDataContainerDataAdded(const std::string& key, DataHandle dh) {
// copy QtDataHandle because signal will be handled by a different thread an indefinite amount of time later:
emit dataContainerChanged(QString::fromStdString(key), QtDataHandle(dh));
}
......
......@@ -87,7 +87,7 @@ namespace campvis {
/**
* Slot called when _dataContainer has changed and emitted the s_dataAdded signal.
*/
void onDataContainerDataAdded(const std::string&, const DataHandle&);
void onDataContainerDataAdded(const std::string&, DataHandle);
/**
* Size hint for the default window size
......
......@@ -82,7 +82,7 @@ namespace campvis {
// ================================================================================================
DataHandleTreeItem::DataHandleTreeItem(const QtDataHandle& dataHandle, const std::string& name, TreeItem* parent)
DataHandleTreeItem::DataHandleTreeItem(QtDataHandle dataHandle, const std::string& name, TreeItem* parent)
: TreeItem(parent)
, _dataHandle(dataHandle)
, _name(name)
......@@ -150,7 +150,7 @@ namespace campvis {
DataHandleTreeItem::~DataHandleTreeItem() {
}
void DataHandleTreeItem::setDataHandle(const QtDataHandle& dataHandle) {
void DataHandleTreeItem::setDataHandle(QtDataHandle dataHandle) {
_dataHandle = dataHandle;
updateChildren();
}
......
......@@ -62,7 +62,7 @@ namespace campvis {
* \param name Name of the QtDataHandle
* \param parent Parent TreeItem
*/
DataHandleTreeItem(const QtDataHandle& dataHandle, const std::string& name, TreeItem* parent);
DataHandleTreeItem(QtDataHandle dataHandle, const std::string& name, TreeItem* parent);
/**
* Destructor, deletes the QtDataHandle
......@@ -77,7 +77,7 @@ namespace campvis {
* \note DataHandleTreeItem takes ownership of this pointer.
* \param dataHandle The QtDataHandle to wrap around, DataHandleTreeItem takes ownership of this pointer!
*/
void setDataHandle(const QtDataHandle& dataHandle);
void setDataHandle(QtDataHandle dataHandle);
private:
/**
......
......@@ -46,6 +46,7 @@ namespace campvis {
sl.append(QString::fromStdString(tmp[i].first));
_combobox->addItems(sl);
dc->s_dataAdded.connect(this, &DataNamePropertyWidget::onDataAdded);
connect(this, SIGNAL(s_dataAddedQt(const QString&, QtDataHandle)), this, SLOT(onDataAddedQt(const QString&, QtDataHandle)));
setCurrentComboBoxText(QString::fromStdString(property->getValue()));
}
......@@ -98,9 +99,13 @@ namespace campvis {
--_ignorePropertyUpdates;
}
void DataNamePropertyWidget::onDataAdded(const std::string& key, const DataHandle& /*dh*/) {
if (_combobox->findText(QString::fromStdString(key)) == -1) {
_combobox->addItem(QString::fromStdString(key));
void DataNamePropertyWidget::onDataAdded(const std::string& key, DataHandle dh) {
emit s_dataAddedQt(QString::fromStdString(key), dh);
}
void DataNamePropertyWidget::onDataAddedQt(const QString& key, QtDataHandle dh) {
if (_combobox->findText(key) == -1) {
_combobox->addItem(key);
}
}
......
......@@ -27,6 +27,7 @@
#include "sigslot/sigslot.h"
#include "core/properties/datanameproperty.h"
#include "application/gui/qtdatahandle.h"
#include "application/gui/properties/abstractpropertywidget.h"
#include "application/gui/properties/propertywidgetfactory.h"
......@@ -64,10 +65,14 @@ namespace campvis {
*/
virtual void updateWidgetFromProperty();
void onDataAdded(const std::string& key, const DataHandle& dh);
void onDataAdded(const std::string& key, DataHandle dh);
private slots:
void onTextChanged(const QString& text);
void onDataAddedQt(const QString& key, QtDataHandle dh);
signals:
void s_dataAddedQt(const QString& key, QtDataHandle dh);
private:
/**
......
......@@ -55,7 +55,7 @@ namespace campvis {
return dh;
}
void DataContainer::addDataHandle(const std::string& name, const DataHandle& dh) {
void DataContainer::addDataHandle(const std::string& name, DataHandle dh) {
if (name.empty()) {
LERROR("Tried to add data with empty name to DataContainer.");
return;
......
......@@ -82,7 +82,7 @@ namespace campvis {
* \param name Key for accessing the DataHandle within this DataContainer
* \param data DataHandle to add.
*/
void addDataHandle(const std::string& name, const DataHandle& dh);
void addDataHandle(const std::string& name, DataHandle dh);
/**
* Checks whether this DataContainer contains a DataHandle with the given name.
......@@ -146,7 +146,7 @@ namespace campvis {
* Signal emitted when data has been added to this DataContainer (this includes also data being replaced).
* First parameter is the name of the added data, second parameter contains a DataHandle to the new data.
*/
sigslot::signal2<const std::string&, const DataHandle&> s_dataAdded;
sigslot::signal2<const std::string&, DataHandle> s_dataAdded;
/// Signal emitted when list of DataHandles has changed.
sigslot::signal0 s_changed;
......
......@@ -75,7 +75,7 @@ namespace campvis {
* Gets the DataHandle.
* \return dh
*/
const DataHandle& getDataHandle() const {
DataHandle getDataHandle() const {
return dh;
}
......
......@@ -247,7 +247,7 @@ namespace campvis {
#endif
}
void AbstractPipeline::onDataContainerDataAdded(const std::string& name, const DataHandle& dh) {
void AbstractPipeline::onDataContainerDataAdded(const std::string& name, DataHandle dh) {
if (name == _renderTargetID.getValue()) {
s_renderTargetChanged();
}
......
......@@ -207,7 +207,7 @@ namespace campvis {
* \param name Name of the added data.
* \param dh DataHandle to the newly added data.
*/
virtual void onDataContainerDataAdded(const std::string& name, const DataHandle& dh);
virtual void onDataContainerDataAdded(const std::string& name, DataHandle dh);
/// Pointer to the DataContainer containing local working set of data for this Pipeline, must not be 0.
DataContainer* _data;
......
......@@ -127,7 +127,7 @@ namespace campvis {
}
}
void AutoEvaluationPipeline::onDataContainerDataAdded(const std::string& name, const DataHandle& dh) {
void AutoEvaluationPipeline::onDataContainerDataAdded(const std::string& name, DataHandle dh) {
{
// acquire read lock
tbb::spin_rw_mutex::scoped_lock lock(_pmMutex, false);
......
......@@ -86,7 +86,7 @@ namespace campvis {
* \param name Name of the added data.
* \param dh DataHandle to the newly added data.
*/
virtual void onDataContainerDataAdded(const std::string& name, const DataHandle& dh);
virtual void onDataContainerDataAdded(const std::string& name, DataHandle dh);
/**
* Recursively looks for all DataNameProperties in \a pc and adds them to the port map.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment