If AddToSubset() fails, we now show an error alert.

B_QUIT_REQUESTED is no longer forwarded to the application too early.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@15271 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler 2005-12-01 17:08:16 +00:00
parent 7ae647775e
commit 2057d3c0aa

View File

@ -7,6 +7,7 @@
*/
#include <Alert.h>
#include <Application.h>
#include <Button.h>
#include <MenuField.h>
@ -16,6 +17,7 @@
#include <Window.h>
#include <stdio.h>
#include <string.h>
const uint32 kMsgUpdateLook = 'uplk';
@ -218,8 +220,18 @@ Window::MessageReceived(BMessage* message)
BWindow* window = new Window(Frame().OffsetByCopy(20, 20),
(window_look)look, (window_feel)feel);
if (message->what == kMsgAddSubsetWindow)
window->AddToSubset(this);
if (message->what == kMsgAddSubsetWindow) {
status_t status = window->AddToSubset(this);
if (status != B_OK) {
char text[512];
snprintf(text, sizeof(text),
"Window could not be added to subset:\n\n\%s", strerror(status));
(new BAlert("Alert", text, "Ok"))->Go(NULL);
delete window;
break;
}
}
window->Show();
break;
@ -237,7 +249,7 @@ Window::QuitRequested()
if (!IsModal() && !IsFloating())
gNormalWindowCount--;
if (gNormalWindowCount < 2)
if (gNormalWindowCount < 1)
be_app->PostMessage(B_QUIT_REQUESTED);
return true;