Changeset - eec08765e920
[Not reviewed]
default
0 2 0
Hasan Yavuz Ă–ZDERYA - 10 years ago 2015-07-24 00:03:29
hy@ozderya.net
fix segmentation fault when closing application
2 files changed with 4 insertions and 2 deletions:
0 comments (0 inline, 0 general)
main.cpp
Show inline comments
 
@@ -28,6 +28,7 @@ MainWindow* pMainWindow;
 
void messageHandler(QtMsgType type, const QMessageLogContext &context,
 
                    const QString &msg)
 
{
 
    // TODO: don't call MainWindow::messageHandler if window is destroyed
 
    pMainWindow->messageHandler(type, context, msg);
 
}
 

	
mainwindow.cpp
Show inline comments
 
@@ -192,6 +192,7 @@ MainWindow::~MainWindow()
 
        serialPort.close();
 
    }
 
    delete ui;
 
    ui = NULL; // we check if ui is deleted in messageHandler
 
}
 

	
 
void MainWindow::setupAboutDialog()
 
@@ -728,10 +729,10 @@ void MainWindow::messageHandler(QtMsgTyp
 
            break;
 
    }
 

	
 
    ui->ptLog->appendPlainText(logString);
 
    if (ui != NULL) ui->ptLog->appendPlainText(logString);
 
    std::cerr << logString.toStdString() << std::endl;
 

	
 
    if (type != QtDebugMsg)
 
    if (type != QtDebugMsg && ui != NULL)
 
    {
 
        ui->statusBar->showMessage(msg, 5000);
 
    }
0 comments (0 inline, 0 general)