Call get_clone_info and get_clone_info_size instead of using the
driver's path. More correct. Now we could remove the app_server's command to retrieve the driver's path. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@21408 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -1006,23 +1006,36 @@ BWindowScreen::_InitClone()
|
|||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
accelerant_clone_info_size clone_info_size;
|
||||||
|
get_accelerant_clone_info clone_info;
|
||||||
|
clone_accelerant clone;
|
||||||
|
clone_info_size = (accelerant_clone_info_size)fGetAccelerantHook(B_ACCELERANT_CLONE_INFO_SIZE, NULL);
|
||||||
|
clone_info = (get_accelerant_clone_info)fGetAccelerantHook(B_GET_ACCELERANT_CLONE_INFO, NULL);
|
||||||
|
clone = (clone_accelerant)fGetAccelerantHook(B_CLONE_ACCELERANT, NULL);
|
||||||
|
|
||||||
status = B_ERROR;
|
status = B_ERROR;
|
||||||
clone_accelerant clone = (clone_accelerant)fGetAccelerantHook(B_CLONE_ACCELERANT, 0);
|
if (!clone_info_size || !clone_info || !clone) {
|
||||||
if (clone == NULL) {
|
|
||||||
printf("InitClone: cannot get clone hook\n");
|
printf("InitClone: cannot get clone hook\n");
|
||||||
unload_add_on(fAddonImage);
|
unload_add_on(fAddonImage);
|
||||||
fAddonImage = -1;
|
fAddonImage = -1;
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
link.StartMessage(AS_GET_DRIVER_PATH);
|
ssize_t cloneInfoSize = clone_info_size();
|
||||||
link.Attach<int32>(fWorkspaceIndex);
|
void *cloneInfo = malloc(cloneInfoSize);
|
||||||
if (link.FlushWithReply(status) == B_OK && status == B_OK) {
|
if (!cloneInfo) {
|
||||||
BString driverPath;
|
unload_add_on(fAddonImage);
|
||||||
link.ReadString(driverPath);
|
fAddonImage = -1;
|
||||||
status = clone((void *)driverPath.String());
|
return B_NO_MEMORY;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
clone_info(cloneInfo);
|
||||||
|
// no way to see if this call fails
|
||||||
|
|
||||||
|
status = clone(cloneInfo);
|
||||||
|
|
||||||
|
free(cloneInfo);
|
||||||
|
|
||||||
if (status < B_OK) {
|
if (status < B_OK) {
|
||||||
printf("InitClone: cannot clone accelerant\n");
|
printf("InitClone: cannot clone accelerant\n");
|
||||||
unload_add_on(fAddonImage);
|
unload_add_on(fAddonImage);
|
||||||
|
|||||||
Reference in New Issue
Block a user