SerialBusConnection: Use member initialization

And as we have full C++11 support, so its also preferred to use nullptr.
This commit is contained in:
Andre Hartmann
2017-11-25 17:27:47 +01:00
parent 84cb598a0d
commit d69947bf2f
2 changed files with 2 additions and 3 deletions
+1 -2
View File
@@ -13,7 +13,6 @@
SerialBusConnection::SerialBusConnection(QString portName) : SerialBusConnection::SerialBusConnection(QString portName) :
CANConnection(portName, CANCon::SOCKETCAN, 1, 4000, true), CANConnection(portName, CANCon::SOCKETCAN, 1, 4000, true),
mDev_p(NULL),
mTimer(this) /*NB: set connection as parent of timer to manage it from working thread */ mTimer(this) /*NB: set connection as parent of timer to manage it from working thread */
{ {
} }
@@ -135,7 +134,7 @@ void SerialBusConnection::disconnectDevice() {
if(mDev_p) { if(mDev_p) {
mDev_p->disconnectDevice(); mDev_p->disconnectDevice();
delete mDev_p; delete mDev_p;
mDev_p = Q_NULLPTR; mDev_p = nullptr;
} }
} }
+1 -1
View File
@@ -33,7 +33,7 @@ private slots:
void testConnection(); void testConnection();
protected: protected:
QCanBusDevice* mDev_p; QCanBusDevice *mDev_p = nullptr;
QTimer mTimer; QTimer mTimer;
}; };