can I assign another object after using deleteLater(); funcation?
-
is it fine? if i will assign new object to
currentDataFilepointer. once I calldeleteLater()for old object with help ofcurrentDataFile.private member of class
QFile* currentDataFile; QString currentDataFilePath;method of class
void DataHandle::createNewDataFile(uint16_t nodeNum, const ExperimentSummaryInfo_t &expInfo) { if (!currentDataFile) { createNewFilePath(nodeNum, expInfo); currentDataFile->flush(); currentDataFile->close(); currentDataFile->deleteLater(); } currentDataFile = new QFile(currentDataFilePath); if (!currentDataFile->open(QIODevice::WriteOnly)) { currentDataFile->close(); currentDataFile->deleteLater(); } return; } -
is it fine? if i will assign new object to
currentDataFilepointer. once I calldeleteLater()for old object with help ofcurrentDataFile.private member of class
QFile* currentDataFile; QString currentDataFilePath;method of class
void DataHandle::createNewDataFile(uint16_t nodeNum, const ExperimentSummaryInfo_t &expInfo) { if (!currentDataFile) { createNewFilePath(nodeNum, expInfo); currentDataFile->flush(); currentDataFile->close(); currentDataFile->deleteLater(); } currentDataFile = new QFile(currentDataFilePath); if (!currentDataFile->open(QIODevice::WriteOnly)) { currentDataFile->close(); currentDataFile->deleteLater(); } return; }