Fix Merge Wizard Saving Bug

.. RideItem() is horrible
.. but it kinda works so just work around it
This commit is contained in:
Mark Liversedge
2014-11-25 15:53:41 +00:00
parent 52408ad1b5
commit b12d966aef
2 changed files with 22 additions and 7 deletions

View File

@@ -1165,9 +1165,8 @@ MergeConfirm::MergeConfirm(MergeActivityWizard *parent) : QWizardPage(parent), w
QLabel *label = new QLabel(tr("Press Finish to update the current ride with "
" the combined data.\n\n"
"The changes will not be saved until you save them "
" so you can check and revert or save.\n\n"
"If you continue the ride will be updated, if you "
"The changes will be saved and cannot be undone.\n\n"
"If you press continue the ride will be saved, if you "
"do not want to continue either go back and change "
"the settings or press cancel to abort."));
label->setWordWrap(true);
@@ -1179,9 +1178,10 @@ MergeConfirm::MergeConfirm(MergeActivityWizard *parent) : QWizardPage(parent), w
bool
MergeConfirm::validatePage()
{
// We are done -- update BUT DOESNT SAVE
// user can now check !
// We are done -- save and mark done
wizard->current->setRide(wizard->combined);
wizard->context->notifyRideDirty();
wizard->context->mainWindow->saveSilent(wizard->context, wizard->current);
wizard->current->setDirty(false); // lose changes
return true;
}

View File

@@ -72,9 +72,24 @@ RideItem::setRide(RideFile *overwrite)
{
RideFile *old = ride_;
ride_ = overwrite; // overwrite
// connect up to new one
connect(ride_, SIGNAL(modified()), this, SLOT(modified()));
connect(ride_, SIGNAL(saved()), this, SLOT(saved()));
connect(ride_, SIGNAL(reverted()), this, SLOT(reverted()));
// don't bother with the old one any more
disconnect(old);
// update status
setDirty(true);
notifyRideDataChanged();
delete old; // now wipe it once referrers had chance to change
//XXX SORRY ! memory leak XXX
//XXX delete old; // now wipe it once referrers had chance to change
//XXX this is only used by MergeActivityWizard and causes issues
//XXX because the data is accessed in separate threads (Wizard is a dialog)
//XXX because it is such an edge case (Merge) we will leave it for now
}
void