Fix BAboutWindow lifecycle
BAboutWindow returned false in QuitRequested in order to hide instead of closing. Not only this keeps a BLooper running for a rarely used window, but it also prevents quitting an application in the window was not destroyed first. * Remove aforementioned QuitRequested method, * Add a static GetWindow method that returns the existing about window, if there is one, or creates one if there is not. A boolean can be set to tell the caller what happened, * Adjust all callers to use that new method, instead of managing the window themselves.
This commit is contained in:
@@ -600,10 +600,6 @@ ActivityView::~ActivityView()
|
||||
{
|
||||
delete fOffscreen;
|
||||
delete fSystemInfoHandler;
|
||||
|
||||
// replicant deleted, destroy the about window
|
||||
if (fAboutWindow != NULL && fAboutWindow->Lock())
|
||||
fAboutWindow->Quit();
|
||||
}
|
||||
|
||||
|
||||
@@ -647,8 +643,6 @@ ActivityView::_Init(const BMessage* settings)
|
||||
const char* name;
|
||||
for (int32 i = 0; settings->FindString("source", i, &name) == B_OK; i++)
|
||||
AddDataSource(DataSource::FindSource(name), settings);
|
||||
|
||||
fAboutWindow = NULL;
|
||||
}
|
||||
|
||||
|
||||
@@ -1112,22 +1106,26 @@ ActivityView::MessageReceived(BMessage* message)
|
||||
|
||||
switch (message->what) {
|
||||
case B_ABOUT_REQUESTED:
|
||||
if (fAboutWindow == NULL) {
|
||||
{
|
||||
bool needsInit;
|
||||
BAboutWindow* window = BAboutWindow::GetWindow(kAppName, kSignature,
|
||||
&needsInit);
|
||||
if (needsInit) {
|
||||
const char* authors[] = {
|
||||
"Axel Dörfler",
|
||||
NULL
|
||||
};
|
||||
|
||||
fAboutWindow = new BAboutWindow(kAppName, kSignature);
|
||||
fAboutWindow->AddCopyright(2008, "Haiku, Inc.");
|
||||
fAboutWindow->AddAuthors(authors);
|
||||
fAboutWindow->Show();
|
||||
} else if (fAboutWindow->IsHidden())
|
||||
fAboutWindow->Show();
|
||||
else
|
||||
fAboutWindow->Activate();
|
||||
window->AddCopyright(2008, "Haiku, Inc.");
|
||||
window->AddAuthors(authors);
|
||||
}
|
||||
|
||||
if (window->IsHidden())
|
||||
window->Show();
|
||||
window->Activate();
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case kMsgUpdateResolution:
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user