From c4f7df69a5702e8b1d6ba452a2a72beb3e0d1687 Mon Sep 17 00:00:00 2001 From: Stefano Ceccherini Date: Thu, 11 Sep 2008 12:02:33 +0000 Subject: [PATCH] be_app could be NULL in BApplication's destructor, if the BApplication didn't initialize itself fully on construction. This fixes a crash when launching some already running application (i.e. print_server) git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@27413 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/kits/app/Application.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/kits/app/Application.cpp b/src/kits/app/Application.cpp index a523572057..482f147c26 100644 --- a/src/kits/app/Application.cpp +++ b/src/kits/app/Application.cpp @@ -233,10 +233,14 @@ BApplication::~BApplication() #ifndef RUN_WITHOUT_APP_SERVER // tell app_server we're quitting... - BPrivate::AppServerLink link; - link.StartMessage(B_QUIT_REQUESTED); - link.Flush(); - + if (be_app) { + // be_app can be NULL here if the application fails to initialize + // correctly. For example, if it's already running and it's set to + // exclusive launch. + BPrivate::AppServerLink link; + link.StartMessage(B_QUIT_REQUESTED); + link.Flush(); + } delete_port(fServerLink->SenderPort()); delete_port(fServerLink->ReceiverPort()); delete fServerLink;