Reconnect BApplication and trigger reconnect of all BWindows in an application.
* handle bitmap reconnect request in the app server
This commit is contained in:
@@ -26,6 +26,7 @@
|
||||
#include <File.h>
|
||||
#include <Locker.h>
|
||||
#include <MessageRunner.h>
|
||||
#include <ObjectList.h>
|
||||
#include <Path.h>
|
||||
#include <PropertyInfo.h>
|
||||
#include <RegistrarDefs.h>
|
||||
@@ -36,9 +37,11 @@
|
||||
#include <AppMisc.h>
|
||||
#include <AppServerLink.h>
|
||||
#include <AutoLocker.h>
|
||||
#include <BitmapPrivate.h>
|
||||
#include <DraggerPrivate.h>
|
||||
#include <LooperList.h>
|
||||
#include <MenuWindow.h>
|
||||
#include <PicturePrivate.h>
|
||||
#include <PortLink.h>
|
||||
#include <RosterPrivate.h>
|
||||
#include <ServerMemoryAllocator.h>
|
||||
@@ -597,6 +600,12 @@ BApplication::MessageReceived(BMessage *message)
|
||||
be_roster->ActivateApp(Team());
|
||||
break;
|
||||
|
||||
case kMsgAppServerRestarted:
|
||||
{
|
||||
_ReconnectToServer();
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
BLooper::MessageReceived(message);
|
||||
break;
|
||||
@@ -1284,6 +1293,34 @@ BApplication::_ConnectToServer()
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
BApplication::_ReconnectToServer()
|
||||
{
|
||||
delete_port(fServerLink->SenderPort());
|
||||
delete_port(fServerLink->ReceiverPort());
|
||||
invalidate_server_port();
|
||||
|
||||
if (_ConnectToServer() != B_OK)
|
||||
debugger("Can't reconnect to app server!");
|
||||
|
||||
AutoLocker<BLooperList> listLock(gLooperList);
|
||||
if (!listLock.IsLocked())
|
||||
return;
|
||||
|
||||
uint32 count = gLooperList.CountLoopers();
|
||||
for (uint32 i = 0; i < count ; i++) {
|
||||
BWindow* window = dynamic_cast<BWindow*>(gLooperList.LooperAt(i));
|
||||
if (window == NULL)
|
||||
continue;
|
||||
BMessenger windowMessenger(window);
|
||||
windowMessenger.SendMessage(kMsgAppServerRestarted);
|
||||
}
|
||||
|
||||
reconnect_bitmaps_to_app_server();
|
||||
reconnect_pictures_to_app_server();
|
||||
}
|
||||
|
||||
|
||||
#if 0
|
||||
void
|
||||
BApplication::send_drag(BMessage *message, int32 vs_token, BPoint offset,
|
||||
|
||||
Reference in New Issue
Block a user