[qet] qet/qet: [5011] Fix crash

[ Thread Index | Date Index | More lists.tuxfamily.org/qet Archives ]


Revision: 5011
Author:   blacksun
Date:     2017-08-06 13:35:01 +0200 (Sun, 06 Aug 2017)
Log Message:
-----------
Fix crash

Modified Paths:
--------------
    trunk/sources/ui/abstractelementpropertieseditorwidget.cpp
    trunk/sources/ui/abstractelementpropertieseditorwidget.h
    trunk/sources/ui/masterpropertieswidget.cpp
    trunk/sources/ui/masterpropertieswidget.h

Modified: trunk/sources/ui/abstractelementpropertieseditorwidget.cpp
===================================================================
--- trunk/sources/ui/abstractelementpropertieseditorwidget.cpp	2017-08-06 10:18:33 UTC (rev 5010)
+++ trunk/sources/ui/abstractelementpropertieseditorwidget.cpp	2017-08-06 11:35:01 UTC (rev 5011)
@@ -18,6 +18,5 @@
 #include "abstractelementpropertieseditorwidget.h"
 
 AbstractElementPropertiesEditorWidget::AbstractElementPropertiesEditorWidget(QWidget *parent) :
-	PropertiesEditorWidget(parent),
-	m_element (nullptr)
+	PropertiesEditorWidget(parent)
 {}

Modified: trunk/sources/ui/abstractelementpropertieseditorwidget.h
===================================================================
--- trunk/sources/ui/abstractelementpropertieseditorwidget.h	2017-08-06 10:18:33 UTC (rev 5010)
+++ trunk/sources/ui/abstractelementpropertieseditorwidget.h	2017-08-06 11:35:01 UTC (rev 5011)
@@ -19,6 +19,7 @@
 #define ABSTRACTELEMENTPROPERTIESEDITORWIDGET_H
 
 #include "PropertiesEditor/propertieseditorwidget.h"
+#include "QPointer"
 
 class Element;
 
@@ -34,7 +35,7 @@
 		virtual void setElement(Element *element) =0;
 
 	protected:
-		Element *m_element;
+		QPointer <Element> m_element;
 
 
 };

Modified: trunk/sources/ui/masterpropertieswidget.cpp
===================================================================
--- trunk/sources/ui/masterpropertieswidget.cpp	2017-08-06 10:18:33 UTC (rev 5010)
+++ trunk/sources/ui/masterpropertieswidget.cpp	2017-08-06 11:35:01 UTC (rev 5011)
@@ -33,7 +33,6 @@
 MasterPropertiesWidget::MasterPropertiesWidget(Element *elmt, QWidget *parent) :
 	AbstractElementPropertiesEditorWidget(parent),
 	ui(new Ui::MasterPropertiesWidget),
-	m_showed_element (nullptr),
 	m_project(nullptr)
 {
 	ui->setupUi(this);
@@ -99,7 +98,8 @@
 	if (m_showed_element)
 		m_showed_element->setHighlighted(false);
 	
-	m_element->setHighlighted(false);
+	if(m_element)
+		m_element->setHighlighted(false);
 	
 	delete ui;
 }

Modified: trunk/sources/ui/masterpropertieswidget.h
===================================================================
--- trunk/sources/ui/masterpropertieswidget.h	2017-08-06 10:18:33 UTC (rev 5010)
+++ trunk/sources/ui/masterpropertieswidget.h	2017-08-06 11:35:01 UTC (rev 5011)
@@ -71,7 +71,7 @@
 	Ui::MasterPropertiesWidget *ui;
 	QHash <QTreeWidgetItem *, Element *> m_qtwi_hash;
 	QTreeWidgetItem *m_qtwi_at_context_menu = nullptr;
-	Element *m_showed_element;
+	QPointer <Element> m_showed_element;
 	QETProject *m_project;
 	QMenu *m_context_menu;
 	QAction *m_link_action,


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/