From 7b83eeadfff33c709fc7c905b1b339524b5c810b Mon Sep 17 00:00:00 2001 From: Berthold Stoeger Date: Sat, 27 Apr 2019 17:27:37 +0200 Subject: Cleanup: fix leak in delegates A copy of a C-string was assigned to a QString. The copy was never freed. Instead, assign the C-string directly. This does the right thing. Signed-off-by: Berthold Stoeger --- desktop-widgets/modeldelegates.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/desktop-widgets/modeldelegates.cpp b/desktop-widgets/modeldelegates.cpp index 1099ebb69..297a963a5 100644 --- a/desktop-widgets/modeldelegates.cpp +++ b/desktop-widgets/modeldelegates.cpp @@ -294,7 +294,7 @@ QWidget *TankInfoDelegate::createEditor(QWidget *parent, const QStyleOptionViewI QWidget *delegate = ComboBoxDelegate::createEditor(parent, option, index); CylindersModel *mymodel = qobject_cast(currCombo.model); cylinder_t *cyl = mymodel->cylinderAt(index); - currCylinderData.type = copy_string(cyl->type.description); + currCylinderData.type = cyl->type.description; currCylinderData.pressure = cyl->type.workingpressure.mbar; currCylinderData.size = cyl->type.size.mliter; MainWindow::instance()->graphics->setReplot(false); @@ -372,7 +372,7 @@ QWidget *WSInfoDelegate::createEditor(QWidget *parent, const QStyleOptionViewIte QWidget *editor = ComboBoxDelegate::createEditor(parent, option, index); WeightModel *mymodel = qobject_cast(currCombo.model); weightsystem_t *ws = mymodel->weightSystemAt(index); - currWeight.type = copy_string(ws->description); + currWeight.type = ws->description; currWeight.weight = ws->weight.grams; return editor; } -- cgit v1.2.3-70-g09d2