>From 6d08fc3ff64b841b468d77755cae8d10fef242b4 Mon Sep 17 00:00:00 2001 From: Jon TURNEY Date: Fri, 10 Dec 2010 18:20:45 +0000 Subject: [PATCH] Fix bug with prereq warning page in unattended modes If you run setup -M and remove a package which is a dependency of another installed package, setup fails to advance, and gets stuck in the dependency checking progress page. Returning 0 to OnUnattended() seems inadvisable. This makes PSN_SETACTIVE get a return value of -1, which, according to the documentation, "activate[s] the next or the previous page (depending on whether the user clicked the Next or Back button)." If no button has actually been clicked (which will usually be the case in unattended mode), it seems to select the next page in the order defined by the propsheet. Normally, this is fine. But the next page in this sequence after IDD_PREREQ is IDD_INSTATUS, which appears several times in the actual sequence to report the status of different tasks, and the work it does is controlled by ThreeBarProgressPage::SetActivateTask(). If we advanced to IDD_INSTATUS without changing the task, it will repeat the previous one. In chooser-only mode, allow activation of the dependency warning page to succeed. In unattended mode, advance to install or download task as appropriate. (Also, update comment to clarify meaning of OnUnattended() returning 0) (Other users of a return value of 0 in OnUnattended() are SplashPage (which is the first page), and PostInstallResultsPage, both of which are fine as the next page in the propsheet sequence is the correct one, although an explicit use of OnNext() would be clearer) Signed-off-by: Jon TURNEY --- prereq.cc | 19 +++++++++++++++++++ prereq.h | 4 +++- proppage.cc | 2 +- 3 files changed, 23 insertions(+), 2 deletions(-) diff --git a/prereq.cc b/prereq.cc index e1871ef..7523c50 100644 --- a/prereq.cc +++ b/prereq.cc @@ -117,6 +117,13 @@ PrereqPage::OnNext () PrereqChecker p; p.selectMissing (); } + + return whatNext(); +} + +long +PrereqPage::whatNext () +{ if (source == IDC_SOURCE_CWD) { // Next, install @@ -136,6 +143,18 @@ PrereqPage::OnBack () return IDD_CHOOSE; } +long +PrereqPage::OnUnattended () +{ + // in chooser-only mode, show this page so the user can choose to fix dependency problems or not + if (unattended_mode == chooseronly) + return -1; + + // in unattended mode, carry on to download/install + // (this can only happen if there some kind of problem with dependencies, as all required dependencies + // should be selected automatically by the chooser page in unattended mode, so we should never get here) + return whatNext(); +} // --------------------------------------------------------------------------- // implements class PrereqChecker diff --git a/prereq.h b/prereq.h index d4aebf2..39347aa 100644 --- a/prereq.h +++ b/prereq.h @@ -26,7 +26,9 @@ public: virtual void OnActivate (); virtual long OnNext (); virtual long OnBack (); - virtual long OnUnattended () { return 0; }; + virtual long OnUnattended (); +private: + long whatNext (); }; class PrereqChecker diff --git a/proppage.cc b/proppage.cc index 8441f66..cc3fbc7 100644 --- a/proppage.cc +++ b/proppage.cc @@ -190,7 +190,7 @@ PropertyPage::DialogProc (UINT message, WPARAM wParam, LPARAM lParam) { // -2 == disable unattended mode, display page // -1 == display page but stay in unattended mode (progress bars) - // 0 == skip to next page + // 0 == skip to next page (in propsheet sequence) // IDD_* == skip to specified page long nextwindow = OnUnattended(); if (nextwindow == -2) -- 1.7.2.3