SoftwareUpdater: fix crash on exit.
Don't delete or Quit() a BWindow, it can do so by itself. Also, do not rebuild a BMessenger everytime we want to message a window, that defeats the purpose. There are still places where the UpdateManager calls functions from the window object directly however, ignoring the fact that the window may have been closed. Fixes #13653. Change-Id: I868e94a07d9617f343332ea00d35ffd92e60ed8e Reviewed-on: https://review.haiku-os.org/c/haiku/+/2552 Reviewed-by: waddlesplash <[email protected]>
This commit is contained in:
committed by
waddlesplash
parent
d0e1eb7a7b
commit
c39f9cc827
@@ -45,26 +45,20 @@ UpdateManager::UpdateManager(BPackageInstallationLocation location,
|
|||||||
BPackageManager(location, &fClientInstallationInterface, this),
|
BPackageManager(location, &fClientInstallationInterface, this),
|
||||||
BPackageManager::UserInteractionHandler(),
|
BPackageManager::UserInteractionHandler(),
|
||||||
fClientInstallationInterface(),
|
fClientInstallationInterface(),
|
||||||
fStatusWindow(NULL),
|
fStatusWindow(new SoftwareUpdaterWindow()),
|
||||||
|
fStatusWindowMessenger(fStatusWindow),
|
||||||
|
fProblemWindow(NULL),
|
||||||
|
fProblemWindowMessenger(),
|
||||||
fCurrentStep(ACTION_STEP_INIT),
|
fCurrentStep(ACTION_STEP_INIT),
|
||||||
fChangesConfirmed(false),
|
fChangesConfirmed(false),
|
||||||
fVerbose(verbose)
|
fVerbose(verbose)
|
||||||
{
|
{
|
||||||
fStatusWindow = new SoftwareUpdaterWindow();
|
|
||||||
_SetCurrentStep(ACTION_STEP_START);
|
_SetCurrentStep(ACTION_STEP_START);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
UpdateManager::~UpdateManager()
|
UpdateManager::~UpdateManager()
|
||||||
{
|
{
|
||||||
if (fStatusWindow != NULL) {
|
|
||||||
fStatusWindow->Lock();
|
|
||||||
fStatusWindow->Quit();
|
|
||||||
}
|
|
||||||
if (fProblemWindow != NULL) {
|
|
||||||
fProblemWindow->Lock();
|
|
||||||
fProblemWindow->Quit();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -92,11 +86,10 @@ update_type
|
|||||||
UpdateManager::GetUpdateType()
|
UpdateManager::GetUpdateType()
|
||||||
{
|
{
|
||||||
int32 action = USER_SELECTION_NEEDED;
|
int32 action = USER_SELECTION_NEEDED;
|
||||||
BMessenger messenger(fStatusWindow);
|
if (fStatusWindowMessenger.IsValid()) {
|
||||||
if (messenger.IsValid()) {
|
|
||||||
BMessage message(kMsgGetUpdateType);
|
BMessage message(kMsgGetUpdateType);
|
||||||
BMessage reply;
|
BMessage reply;
|
||||||
messenger.SendMessage(&message, &reply);
|
fStatusWindowMessenger.SendMessage(&message, &reply);
|
||||||
reply.FindInt32(kKeyAlertResult, &action);
|
reply.FindInt32(kKeyAlertResult, &action);
|
||||||
}
|
}
|
||||||
return (update_type)action;
|
return (update_type)action;
|
||||||
@@ -110,11 +103,10 @@ UpdateManager::CheckRepositories()
|
|||||||
if (fVerbose)
|
if (fVerbose)
|
||||||
printf("Remote repositories available: %" B_PRId32 "\n", count);
|
printf("Remote repositories available: %" B_PRId32 "\n", count);
|
||||||
if (count == 0) {
|
if (count == 0) {
|
||||||
BMessenger messenger(fStatusWindow);
|
if (fStatusWindowMessenger.IsValid()) {
|
||||||
if (messenger.IsValid()) {
|
|
||||||
BMessage message(kMsgNoRepositories);
|
BMessage message(kMsgNoRepositories);
|
||||||
BMessage reply;
|
BMessage reply;
|
||||||
messenger.SendMessage(&message, &reply);
|
fStatusWindowMessenger.SendMessage(&message, &reply);
|
||||||
int32 result;
|
int32 result;
|
||||||
reply.FindInt32(kKeyAlertResult, &result);
|
reply.FindInt32(kKeyAlertResult, &result);
|
||||||
if (result == 1)
|
if (result == 1)
|
||||||
@@ -159,8 +151,10 @@ UpdateManager::FinalUpdate(const char* header, const char* text)
|
|||||||
void
|
void
|
||||||
UpdateManager::HandleProblems()
|
UpdateManager::HandleProblems()
|
||||||
{
|
{
|
||||||
if (fProblemWindow == NULL)
|
if (fProblemWindow == NULL) {
|
||||||
fProblemWindow = new ProblemWindow;
|
fProblemWindow = new ProblemWindow;
|
||||||
|
fProblemWindowMessenger.SetTo(fProblemWindow);
|
||||||
|
}
|
||||||
|
|
||||||
ProblemWindow::SolverPackageSet installPackages;
|
ProblemWindow::SolverPackageSet installPackages;
|
||||||
ProblemWindow::SolverPackageSet uninstallPackages;
|
ProblemWindow::SolverPackageSet uninstallPackages;
|
||||||
|
|||||||
@@ -88,7 +88,9 @@ private:
|
|||||||
fClientInstallationInterface;
|
fClientInstallationInterface;
|
||||||
|
|
||||||
SoftwareUpdaterWindow* fStatusWindow;
|
SoftwareUpdaterWindow* fStatusWindow;
|
||||||
|
BMessenger fStatusWindowMessenger;
|
||||||
ProblemWindow* fProblemWindow;
|
ProblemWindow* fProblemWindow;
|
||||||
|
BMessenger fProblemWindowMessenger;
|
||||||
uint32 fCurrentStep;
|
uint32 fCurrentStep;
|
||||||
bool fChangesConfirmed;
|
bool fChangesConfirmed;
|
||||||
bool fNewDownloadStarted;
|
bool fNewDownloadStarted;
|
||||||
|
|||||||
Reference in New Issue
Block a user