Set the about window object to NULL on close or quit.
Pass the BHandler object that opened the about window to BAboutWindow. When the window closes, send a kAboutWindowClosed message back to the handler. This allows the handler to set the variable to NULL. Implement the new about dialog constructor in all apps that use it. Remove the old constructor. This now works reliably for all cases I tested without crashing and does the right thing on close. The setup and teardown is a bit more complicated than I wanted though. Unfortunately this seems to be necessary when not using a BAlert. Fetching the app icon does not work reliably yet. This is because for replicants the app may not be running. I may have to pass the icon in instead of grabbing it from the signature.
This commit is contained in:
@@ -601,7 +601,9 @@ ActivityView::~ActivityView()
|
||||
delete fOffscreen;
|
||||
delete fSystemInfoHandler;
|
||||
|
||||
fAboutWindow->Quit();
|
||||
// replicant deleted, destroy the about window
|
||||
if (fAboutWindow != NULL)
|
||||
fAboutWindow->Quit();
|
||||
}
|
||||
|
||||
|
||||
@@ -618,9 +620,6 @@ ActivityView::_Init(const BMessage* settings)
|
||||
#endif
|
||||
SetViewColor(B_TRANSPARENT_COLOR);
|
||||
|
||||
fAboutWindow = new BAboutWindow(kAppName, kSignature);
|
||||
fAboutWindow->AddCopyright(2008, "Haiku, Inc.");
|
||||
|
||||
fLastRefresh = 0;
|
||||
fDrawResolution = 1;
|
||||
fZooming = false;
|
||||
@@ -648,6 +647,8 @@ 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;
|
||||
}
|
||||
|
||||
|
||||
@@ -1111,7 +1112,17 @@ ActivityView::MessageReceived(BMessage* message)
|
||||
|
||||
switch (message->what) {
|
||||
case B_ABOUT_REQUESTED:
|
||||
fAboutWindow->Show();
|
||||
if (fAboutWindow == NULL) {
|
||||
fAboutWindow = new BAboutWindow(this, kAppName, kSignature);
|
||||
fAboutWindow->AddCopyright(2008, "Haiku, Inc.");
|
||||
fAboutWindow->Show();
|
||||
} else
|
||||
fAboutWindow->Activate();
|
||||
|
||||
break;
|
||||
|
||||
case kAboutWindowClosed:
|
||||
fAboutWindow = NULL;
|
||||
break;
|
||||
|
||||
case kMsgUpdateResolution:
|
||||
|
||||
Reference in New Issue
Block a user