Partial fix for database upgrade loop.

Resmed loader still needs to return -1 on error.

Also fixed a crasher in MainWindow::finishCPAPImport.
This commit is contained in:
sawinglogz 2020-05-06 13:40:59 -04:00
parent ad15655ffb
commit d9386a993b
4 changed files with 10 additions and 8 deletions

View File

@ -566,11 +566,12 @@ void Profile::DataFormatError(Machine *m)
// Note: I deliberately haven't added a Profile help for this
if (backups) {
MachineLoader * loader = lookupLoader(m);
/* int c = */
mainwin->importCPAP(ImportPath(m->getBackupPath(), loader),
QObject::tr("Rebuilding from %1 Backup").arg(m->brand()));
// if ( c > 0 )
// m->info.version = loader->Version();
int c = mainwin->importCPAP(ImportPath(m->getBackupPath(), loader),
QObject::tr("Rebuilding from %1 Backup").arg(m->brand()));
if (c >= 0) {
// Make sure the updated version gets saved, even if there were no sessions to import.
mainwin->finishCPAPImport();
}
} else {
if (!p_profile->session->backupCardData()) {
// Automatic backups not available for Intellipap users yet, so don't taunt them..

View File

@ -72,7 +72,7 @@ void initializeLogger()
s_LoggerRunning.lock(); // wait until the thread begins running
s_LoggerRunning.unlock(); // we no longer need the lock
}
qInstallMessageHandler(MyOutputHandler);
qInstallMessageHandler(MyOutputHandler); // NOTE: comment this line out when debugging a crash, otherwise the deferred output will mislead you.
if (b) {
qDebug() << "Started logging thread";
} else {

View File

@ -743,7 +743,8 @@ void MainWindow::finishCPAPImport()
GenerateStatistics();
profileSelector->updateProfileList();
welcome->refreshPage();
if (welcome)
welcome->refreshPage();
if (overview) { overview->ReloadGraphs(); }
if (daily) {

View File

@ -164,6 +164,7 @@ class MainWindow : public QMainWindow
void setStatsHTML(QString html);
int importCPAP(ImportPath import, const QString &message);
void finishCPAPImport();
void startImportDialog() { on_action_Import_Data_triggered(); }
@ -365,7 +366,6 @@ class MainWindow : public QMainWindow
private:
QString getMainWindowTitle();
void importCPAPBackups();
void finishCPAPImport();
QList<ImportPath> detectCPAPCards();
QList<ImportPath> selectCPAPDataCards(const QString & prompt);
void importCPAPDataCards(const QList<ImportPath> & datacards);