summaryrefslogtreecommitdiffstats
path: root/qt-ui/modeldelegates.cpp
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2014-11-14 13:33:12 -0800
committerGravatar Dirk Hohndel <dirk@hohndel.org>2014-11-14 13:45:54 -0800
commit8d766e13e258e206edb2c2746895845de942fa8e (patch)
tree435f3287c34cd20e3da037940dd5349f45861c56 /qt-ui/modeldelegates.cpp
parent1055b5afd35526c552eafcaf26d5f1d9aac43c86 (diff)
downloadsubsurface-8d766e13e258e206edb2c2746895845de942fa8e.tar.gz
Make sure we always have copies of equipment descriptions
Having pointers copied around that might get freed elsewhere could be a problem. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-ui/modeldelegates.cpp')
-rw-r--r--qt-ui/modeldelegates.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/qt-ui/modeldelegates.cpp b/qt-ui/modeldelegates.cpp
index 8b70b48b3..7079173c4 100644
--- a/qt-ui/modeldelegates.cpp
+++ b/qt-ui/modeldelegates.cpp
@@ -271,7 +271,7 @@ QWidget *TankInfoDelegate::createEditor(QWidget *parent, const QStyleOptionViewI
QWidget *delegate = ComboBoxDelegate::createEditor(parent, option, index);
CylindersModel *mymodel = qobject_cast<CylindersModel *>(currCombo.model);
cylinder_t *cyl = mymodel->cylinderAt(index);
- currCylinderData.type = cyl->type.description;
+ currCylinderData.type = copy_string(cyl->type.description);
currCylinderData.pressure = cyl->type.workingpressure.mbar;
currCylinderData.size = cyl->type.size.mliter;
return delegate;
@@ -323,7 +323,7 @@ QWidget *WSInfoDelegate::createEditor(QWidget *parent, const QStyleOptionViewIte
QWidget *editor = ComboBoxDelegate::createEditor(parent, option, index);
WeightModel *mymodel = qobject_cast<WeightModel *>(currCombo.model);
weightsystem_t *ws = mymodel->weightSystemAt(index);
- currWeight.type = ws->description;
+ currWeight.type = copy_string(ws->description);
currWeight.weight = ws->weight.grams;
return editor;
}