From 6ea91ecc4e5830dcc50cdce1f217dd8d0e608562 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89milie=20Feral?= Date: Thu, 6 Sep 2018 17:03:27 +0200 Subject: [PATCH] [shared] ExpressionModel tidy pool of its Expression & Layout when tidying --- apps/shared/expression_model.cpp | 28 ++++------------------------ 1 file changed, 4 insertions(+), 24 deletions(-) diff --git a/apps/shared/expression_model.cpp b/apps/shared/expression_model.cpp index b59693407..3d641e1f5 100644 --- a/apps/shared/expression_model.cpp +++ b/apps/shared/expression_model.cpp @@ -47,33 +47,13 @@ void ExpressionModel::setContent(const char * c) { /* We cannot call tidy here because tidy is a virtual function and does not * do the same thing for all children class. And here we want to delete only * the m_layout and m_expression. */ -// TODO: the previous expression and layout are going to be destroyed as soon as we call expression(). Should we optimize this? -#if 0 - if (!m_layoutRef.isUninitialized()) { - m_layoutRef = LayoutRef(); - } - if (m_expression != nullptr) { - delete m_expression; - m_expression = nullptr; - } -#endif + m_layoutRef = LayoutRef(); + m_expression = Expression(); } void ExpressionModel::tidy() { -// TODO: what do we want to do? Delete layout and ref? -#if 0 - m_layoutRef = LayoutRef(); ? - m_expression = Expression(); ? - - - if (!m_layoutRef.isUninitialized()) { - m_layoutRef = LayoutRef(); - } - if (m_expression != nullptr) { - delete m_expression; - m_expression = nullptr; - } -#endif + m_layoutRef = LayoutRef(); + m_expression = Expression(); } }