Skip to content

Commit 0fd1f2a

Browse files
authored
Fix debug crash because intermediate function result goes out of scope (#9)
* Fix crash because intermediate function result goes out of scope, same as: ManiVaultStudio/Scatterplot@29c0bc0 * This plugin only handles points * Move variables to if * default destructor * Remove unused variable
1 parent fdd0f5f commit 0fd1f2a

2 files changed

Lines changed: 9 additions & 17 deletions

File tree

DVRTransferFunction/src/TransferFunctionPlugin.cpp

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -87,18 +87,12 @@ TransferFunctionPlugin::TransferFunctionPlugin(const PluginFactory* factory) :
8787
if (datasetsMimeData->getDatasets().count() > 1)
8888
return dropRegions;
8989

90-
const auto& dataset = datasetsMimeData->getDatasets().first();
91-
const auto datasetGuiName = dataset->text();
92-
const auto datasetId = dataset->getId();
93-
const auto dataType = dataset->getDataType();
94-
const auto dataTypes = DataTypes({ PointType , ColorType, ClusterType });
95-
96-
// Check if the data type can be dropped
97-
if (!dataTypes.contains(dataType))
98-
dropRegions << new DropWidget::DropRegion(this, "Incompatible data", "This type of data is not supported", "exclamation-circle", false);
90+
const auto dataset = datasetsMimeData->getDatasets().first();
9991

10092
// Points dataset is about to be dropped
101-
if (dataType == PointType) {
93+
if (dataset->getDataType() == PointType) {
94+
const auto datasetGuiName = dataset->text();
95+
const auto datasetId = dataset->getId();
10296

10397
// Get points dataset from the core
10498
auto candidateDataset = mv::data().getDataset<Points>(datasetId);
@@ -125,6 +119,10 @@ TransferFunctionPlugin::TransferFunctionPlugin(const PluginFactory* factory) :
125119
}
126120
}
127121
}
122+
else
123+
{
124+
dropRegions << new DropWidget::DropRegion(this, "Incompatible data", "This type of data is not supported", "exclamation-circle", false);
125+
}
128126

129127
return dropRegions;
130128
});
@@ -155,10 +153,6 @@ TransferFunctionPlugin::TransferFunctionPlugin(const PluginFactory* factory) :
155153
getLearningCenterAction().addVideos(QStringList({ "Practitioner", "Developer" }));
156154
}
157155

158-
TransferFunctionPlugin::~TransferFunctionPlugin()
159-
{
160-
}
161-
162156
void TransferFunctionPlugin::init()
163157
{
164158
auto layout = new QVBoxLayout();

DVRTransferFunction/src/TransferFunctionPlugin.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ class TransferFunctionPlugin : public ViewPlugin
3131

3232
public:
3333
TransferFunctionPlugin(const PluginFactory* factory);
34-
~TransferFunctionPlugin() override;
34+
~TransferFunctionPlugin() override = default;
3535

3636
void init() override;
3737

@@ -95,8 +95,6 @@ class TransferFunctionPlugin : public ViewPlugin
9595
QPointer<MaterialSettings> _materialSettings; /** Material settings action */
9696
QPointer<HorizontalToolbarAction> _primaryToolbarAction; /** Horizontal toolbar for primary content */
9797

98-
static const std::int32_t LAZY_UPDATE_INTERVAL = 2;
99-
10098
};
10199

102100
// =============================================================================

0 commit comments

Comments
 (0)