diff --git a/src/servers/app/AppServer.cpp b/src/servers/app/AppServer.cpp index e401ba4a51..5a36860168 100644 --- a/src/servers/app/AppServer.cpp +++ b/src/servers/app/AppServer.cpp @@ -93,7 +93,7 @@ AppServer::AppServer(void) : fCursorSem(-1), fCursorArea(-1) { - fMessagePort= create_port(200, SERVER_PORT_NAME); + fMessagePort = create_port(200, SERVER_PORT_NAME); if (fMessagePort == B_NO_MORE_PORTS) debugger("app_server could not create message port"); @@ -570,7 +570,7 @@ void AppServer::DispatchMessage(int32 code, BPortLink &msg) BPortLink replylink(app_port); replylink.StartMessage(SERVER_TRUE); - replylink.Attach(newapp->fMessagePort); + replylink.Attach(server_listen); replylink.Flush(); // This is necessary because BPortLink::ReadString allocates memory @@ -603,7 +603,7 @@ void AppServer::DispatchMessage(int32 code, BPortLink &msg) { srvapp=(ServerApp *)fAppList->ItemAt(i); - if(srvapp != NULL && srvapp->fMonitorThreadID== srvapp_id) + if(srvapp != NULL && srvapp->MonitorThreadID() == srvapp_id) { srvapp=(ServerApp *)fAppList->RemoveItem(i); if(srvapp) @@ -763,14 +763,14 @@ void AppServer::DispatchMessage(int32 code, BPortLink &msg) // thread_id. We will only wait so long, because then the app is probably crashed // or hung. Seeing that being the case, we'll kill its BApp team and fake the // quit message - if(get_thread_info(app->fMonitorThreadID, &tinfo)==B_OK) + if(get_thread_info(app->MonitorThreadID(), &tinfo)==B_OK) { bool killteam=true; for(int32 j=0; j<5; j++) { snooze(500000); // wait half a second for it to quit - if(get_thread_info(app->fMonitorThreadID, &tinfo)!=B_OK) + if(get_thread_info(app->MonitorThreadID(), &tinfo)!=B_OK) { killteam=false; break; @@ -856,7 +856,7 @@ ServerApp *AppServer::FindApp(const char *sig) for(int32 i=0; iCountItems();i++) { foundapp=(ServerApp*)fAppList->ItemAt(i); - if(foundapp && foundapp->fSignature==sig) + if(foundapp && foundapp->Title() == sig) { release_sem(fAppListLock); return foundapp; diff --git a/src/servers/app/ServerApp.cpp b/src/servers/app/ServerApp.cpp index d81b22ddcd..ab6944cb76 100644 --- a/src/servers/app/ServerApp.cpp +++ b/src/servers/app/ServerApp.cpp @@ -25,6 +25,8 @@ // //------------------------------------------------------------------------------ #include +#include +#include #include #include #include @@ -1915,8 +1917,17 @@ ServerBitmap *ServerApp::FindBitmap(int32 token) return NULL; } -team_id ServerApp::ClientTeamID() + +team_id +ServerApp::ClientTeamID() const { return fClientTeamID; } + +thread_id +ServerApp::MonitorThreadID() const +{ + return fMonitorThreadID; +} + diff --git a/src/servers/app/ServerApp.h b/src/servers/app/ServerApp.h index 50d2620404..465df896f2 100644 --- a/src/servers/app/ServerApp.h +++ b/src/servers/app/ServerApp.h @@ -30,32 +30,30 @@ #include #include -#include -#include + #include "FMWList.h" -class AppServer; +class AreaPool; class BMessage; class BPortLink; class BList; class DisplayDriver; +class LinkMsgReader; +class LinkMsgSender; class ServerCursor; class ServerBitmap; -class AreaPool; /*! \class ServerApp ServerApp.h \brief Counterpart to BApplication within the app_server */ -class ServerApp -{ +class ServerApp { public: ServerApp(port_id sendport, port_id rcvport, port_id clientLooperPort, team_id clientTeamID, int32 handlerID, char *signature); virtual ~ServerApp(void); bool Run(void); - static int32 MonitorApp(void *data); void Lock(void); void Unlock(void); bool IsLocked(void); @@ -75,16 +73,20 @@ public: void SetAppCursor(void); ServerBitmap *FindBitmap(int32 token); - team_id ClientTeamID(); + team_id ClientTeamID() const; + thread_id MonitorThreadID() const; FMWList fAppFMWList; -const char * Title() const { return fSignature.String(); } + + const char *Title() const { return fSignature.String(); } + private: - friend class AppServer; friend class ServerWindow; void DispatchMessage(int32 code, LinkMsgReader &link); + static int32 MonitorApp(void *data); + port_id fClientAppPort, fMessagePort, // TODO: find out why there is both the app port and the looper port. Do