1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2024-12-02 10:24:11 +01:00

OP-682 fixed two crashes on firmware uploader gadget.

crash 1 :  would happen when clicking Halt and then Boot as soon as the Boot button became enabled.
crash 2 : would happen when clicking Boot and then quickly pressing then Open button.
This commit is contained in:
filnet 2013-01-24 03:53:24 +01:00
parent 1a303aa85f
commit 813aaf5d85
2 changed files with 10 additions and 4 deletions

View File

@ -144,6 +144,8 @@ void deviceWidget::populate()
void deviceWidget::freeze() void deviceWidget::freeze()
{ {
myDevice->description->setEnabled(false); myDevice->description->setEnabled(false);
myDevice->pbLoad->setEnabled(false);
myDevice->youdont->setEnabled(false);
myDevice->updateButton->setEnabled(false); myDevice->updateButton->setEnabled(false);
myDevice->retrieveButton->setEnabled(false); myDevice->retrieveButton->setEnabled(false);
} }

View File

@ -398,7 +398,7 @@ void UploaderGadgetWidget::systemReset()
delete dfu; delete dfu;
dfu = NULL; dfu = NULL;
} }
m_config->textBrowser->clear(); clearLog();
log("Board Reset initiated."); log("Board Reset initiated.");
goToBootloader(); goToBootloader();
} }
@ -470,15 +470,18 @@ void UploaderGadgetWidget::commonSystemBoot(bool safeboot)
// Freeze the tabs, they are not useful anymore and their buttons // Freeze the tabs, they are not useful anymore and their buttons
// will cause segfaults or weird stuff if we use them. // will cause segfaults or weird stuff if we use them.
for (int i=0; i< m_config->systemElements->count(); i++) { for (int i=0; i< m_config->systemElements->count(); i++) {
deviceWidget *qw = (deviceWidget*)m_config->systemElements->widget(i); deviceWidget *qw = dynamic_cast<deviceWidget*>(m_config->systemElements->widget(i));
if (qw) {
qw->freeze(); qw->freeze();
} }
} }
}
currentStep = IAP_STATE_READY; currentStep = IAP_STATE_READY;
log("You can now reconnect telemetry..."); log("You can now reconnect telemetry...");
delete dfu; // Frees up the USB/Serial port too delete dfu; // Frees up the USB/Serial port too
dfu = NULL; dfu = NULL;
} }
bool UploaderGadgetWidget::autoUpdateCapable() bool UploaderGadgetWidget::autoUpdateCapable()
{ {
return QDir(":/build").exists(); return QDir(":/build").exists();
@ -766,9 +769,9 @@ void UploaderGadgetWidget::uploadEnded(bool succeed)
*/ */
void UploaderGadgetWidget::log(QString str) void UploaderGadgetWidget::log(QString str)
{ {
qDebug() << str;
m_config->textBrowser->append(str); m_config->textBrowser->append(str);
m_config->textBrowser->repaint(); m_config->textBrowser->repaint();
} }
void UploaderGadgetWidget::clearLog() void UploaderGadgetWidget::clearLog()
@ -815,6 +818,7 @@ void UploaderGadgetWidget::error(QString errorString, int errorNumber)
msgBox.exec(); msgBox.exec();
m_config->boardStatus->setText(errorString); m_config->boardStatus->setText(errorString);
} }
/** /**
Shows a message box with an information string. Shows a message box with an information string.