I have following code:
void MainWindow::check_for_updates()
{
QNetworkAccessManager *qnam = new QNetworkAccessManager(this);
reply
= qnam
->get
(QNetworkRequest
((QUrl)"http://piorekf.org/plug/VERSION"));
connect(reply, SIGNAL(readyRead()), this, SLOT(httpReadyRead()));
}
void MainWindow::httpReadyRead()
{
if(reply->readAll() > VERSION)
{
QLabel *label
= new QLabel(tr
("<b>Update available!</b>"),
this);
ui->statusBar->addWidget(label);
msgbx->setWindowTitle(tr("Update"));
msgbx->setText(tr("<b>Update available!</b>"));
msgbx->setInformativeText(tr("Check homepage for new version"));
msgbx->show();
// QMessageBox::information(this, "Update", "<b>Update available!</b><br>Check homepage for new version.");
}
else
ui->statusBar->showMessage(tr("You are using the newest version"), 5000);
}
void MainWindow::check_for_updates()
{
QNetworkAccessManager *qnam = new QNetworkAccessManager(this);
reply = qnam->get(QNetworkRequest((QUrl)"http://piorekf.org/plug/VERSION"));
connect(reply, SIGNAL(readyRead()), this, SLOT(httpReadyRead()));
}
void MainWindow::httpReadyRead()
{
if(reply->readAll() > VERSION)
{
QLabel *label = new QLabel(tr("<b>Update available!</b>"), this);
ui->statusBar->addWidget(label);
QMessageBox *msgbx = new QMessageBox;
msgbx->setWindowTitle(tr("Update"));
msgbx->setText(tr("<b>Update available!</b>"));
msgbx->setInformativeText(tr("Check homepage for new version"));
msgbx->setIcon(QMessageBox::Information);
msgbx->show();
// QMessageBox::information(this, "Update", "<b>Update available!</b><br>Check homepage for new version.");
}
else
ui->statusBar->showMessage(tr("You are using the newest version"), 5000);
}
To copy to clipboard, switch view to plain text mode
The problem is that when I use static function (here commented) or change line 19 to "msgbx->exec();" I get Segmentation Fault. I'm using Qt 4.7.2 on Linux. I'm not 100% sure but I think that on Qt 4.7.1 everything was fine and there was no segfault. Any ideas?
Bookmarks