* BWindowScreen::_InitClone() was broken, it called the "get clone info" method

on uninitialized accelerant, but that's what AS_GET_DRIVER_PATH is for.
* This should fix #2847.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28534 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler 2008-11-06 12:44:26 +00:00
parent 3005b1d6f5
commit 33309cb5fc
2 changed files with 70 additions and 77 deletions

View File

@ -925,9 +925,11 @@ BWindowScreen::_InitClone()
if (fAddonImage >= 0)
return B_OK;
BScreen screen(this);
AppServerLink link;
link.StartMessage(AS_GET_ACCELERANT_PATH);
link.Attach<int32>(fWorkspaceIndex);
link.Attach<screen_id>(screen.ID());
status_t status = B_ERROR;
if (link.FlushWithReply(status) < B_OK || status < B_OK)
@ -935,6 +937,17 @@ BWindowScreen::_InitClone()
BString accelerantPath;
link.ReadString(accelerantPath);
link.StartMessage(AS_GET_DRIVER_PATH);
link.Attach<screen_id>(screen.ID());
status = B_ERROR;
if (link.FlushWithReply(status) < B_OK || status < B_OK)
return status;
BString driverPath;
link.ReadString(driverPath);
fAddonImage = load_add_on(accelerantPath.String());
if (fAddonImage < B_OK) {
fprintf(stderr, "InitClone: cannot load accelerant image\n");
@ -947,39 +960,19 @@ BWindowScreen::_InitClone()
fprintf(stderr, "InitClone: cannot get accelerant entry point\n");
unload_add_on(fAddonImage);
fAddonImage = -1;
return status;
return B_NOT_SUPPORTED;
}
accelerant_clone_info_size cloneInfoSizeHook;
get_accelerant_clone_info cloneInfoHook;
clone_accelerant cloneHook;
cloneInfoSizeHook = (accelerant_clone_info_size)fGetAccelerantHook(B_ACCELERANT_CLONE_INFO_SIZE, NULL);
cloneInfoHook = (get_accelerant_clone_info)fGetAccelerantHook(B_GET_ACCELERANT_CLONE_INFO, NULL);
cloneHook = (clone_accelerant)fGetAccelerantHook(B_CLONE_ACCELERANT, NULL);
status = B_ERROR;
if (!cloneInfoSizeHook || !cloneInfoHook || !cloneHook) {
clone_accelerant cloneHook
= (clone_accelerant)fGetAccelerantHook(B_CLONE_ACCELERANT, NULL);
if (cloneHook == NULL) {
fprintf(stderr, "InitClone: cannot get clone hook\n");
unload_add_on(fAddonImage);
fAddonImage = -1;
return status;
return B_NOT_SUPPORTED;
}
ssize_t cloneInfoSize = cloneInfoSizeHook();
void *cloneInfo = malloc(cloneInfoSize);
if (!cloneInfo) {
unload_add_on(fAddonImage);
fAddonImage = -1;
return B_NO_MEMORY;
}
cloneInfoHook(cloneInfo);
// no way to see if this call fails
status = cloneHook(cloneInfo);
free(cloneInfo);
status = cloneHook((void*)driverPath.String());
if (status < B_OK) {
fprintf(stderr, "InitClone: cannot clone accelerant\n");
unload_add_on(fAddonImage);

View File

@ -2524,8 +2524,8 @@ ServerApp::_DispatchMessage(int32 code, BPrivate::LinkReceiver& link)
case AS_GET_ACCELERANT_PATH:
{
int32 index;
fLink.Read<int32>(&index);
screen_id id;
fLink.Read<screen_id>(&id);
BString path;
status_t status = fDesktop->HWInterface()->GetAccelerantPath(path);
@ -2539,8 +2539,8 @@ ServerApp::_DispatchMessage(int32 code, BPrivate::LinkReceiver& link)
case AS_GET_DRIVER_PATH:
{
int32 index;
fLink.Read<int32>(&index);
screen_id id;
fLink.Read<screen_id>(&id);
BString path;
status_t status = fDesktop->HWInterface()->GetDriverPath(path);