* 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:
@@ -925,9 +925,11 @@ BWindowScreen::_InitClone()
|
|||||||
if (fAddonImage >= 0)
|
if (fAddonImage >= 0)
|
||||||
return B_OK;
|
return B_OK;
|
||||||
|
|
||||||
|
BScreen screen(this);
|
||||||
|
|
||||||
AppServerLink link;
|
AppServerLink link;
|
||||||
link.StartMessage(AS_GET_ACCELERANT_PATH);
|
link.StartMessage(AS_GET_ACCELERANT_PATH);
|
||||||
link.Attach<int32>(fWorkspaceIndex);
|
link.Attach<screen_id>(screen.ID());
|
||||||
|
|
||||||
status_t status = B_ERROR;
|
status_t status = B_ERROR;
|
||||||
if (link.FlushWithReply(status) < B_OK || status < B_OK)
|
if (link.FlushWithReply(status) < B_OK || status < B_OK)
|
||||||
@@ -935,6 +937,17 @@ BWindowScreen::_InitClone()
|
|||||||
|
|
||||||
BString accelerantPath;
|
BString accelerantPath;
|
||||||
link.ReadString(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());
|
fAddonImage = load_add_on(accelerantPath.String());
|
||||||
if (fAddonImage < B_OK) {
|
if (fAddonImage < B_OK) {
|
||||||
fprintf(stderr, "InitClone: cannot load accelerant image\n");
|
fprintf(stderr, "InitClone: cannot load accelerant image\n");
|
||||||
@@ -942,44 +955,24 @@ BWindowScreen::_InitClone()
|
|||||||
}
|
}
|
||||||
|
|
||||||
status = get_image_symbol(fAddonImage, B_ACCELERANT_ENTRY_POINT,
|
status = get_image_symbol(fAddonImage, B_ACCELERANT_ENTRY_POINT,
|
||||||
B_SYMBOL_TYPE_TEXT, (void **)&fGetAccelerantHook);
|
B_SYMBOL_TYPE_TEXT, (void**)&fGetAccelerantHook);
|
||||||
if (status < B_OK) {
|
if (status < B_OK) {
|
||||||
fprintf(stderr, "InitClone: cannot get accelerant entry point\n");
|
fprintf(stderr, "InitClone: cannot get accelerant entry point\n");
|
||||||
unload_add_on(fAddonImage);
|
unload_add_on(fAddonImage);
|
||||||
fAddonImage = -1;
|
fAddonImage = -1;
|
||||||
return status;
|
return B_NOT_SUPPORTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
accelerant_clone_info_size cloneInfoSizeHook;
|
clone_accelerant cloneHook
|
||||||
get_accelerant_clone_info cloneInfoHook;
|
= (clone_accelerant)fGetAccelerantHook(B_CLONE_ACCELERANT, NULL);
|
||||||
clone_accelerant cloneHook;
|
if (cloneHook == NULL) {
|
||||||
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) {
|
|
||||||
fprintf(stderr, "InitClone: cannot get clone hook\n");
|
fprintf(stderr, "InitClone: cannot get clone hook\n");
|
||||||
unload_add_on(fAddonImage);
|
unload_add_on(fAddonImage);
|
||||||
fAddonImage = -1;
|
fAddonImage = -1;
|
||||||
return status;
|
return B_NOT_SUPPORTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
ssize_t cloneInfoSize = cloneInfoSizeHook();
|
status = cloneHook((void*)driverPath.String());
|
||||||
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);
|
|
||||||
|
|
||||||
if (status < B_OK) {
|
if (status < B_OK) {
|
||||||
fprintf(stderr, "InitClone: cannot clone accelerant\n");
|
fprintf(stderr, "InitClone: cannot clone accelerant\n");
|
||||||
unload_add_on(fAddonImage);
|
unload_add_on(fAddonImage);
|
||||||
|
|||||||
@@ -2524,8 +2524,8 @@ ServerApp::_DispatchMessage(int32 code, BPrivate::LinkReceiver& link)
|
|||||||
|
|
||||||
case AS_GET_ACCELERANT_PATH:
|
case AS_GET_ACCELERANT_PATH:
|
||||||
{
|
{
|
||||||
int32 index;
|
screen_id id;
|
||||||
fLink.Read<int32>(&index);
|
fLink.Read<screen_id>(&id);
|
||||||
|
|
||||||
BString path;
|
BString path;
|
||||||
status_t status = fDesktop->HWInterface()->GetAccelerantPath(path);
|
status_t status = fDesktop->HWInterface()->GetAccelerantPath(path);
|
||||||
@@ -2539,8 +2539,8 @@ ServerApp::_DispatchMessage(int32 code, BPrivate::LinkReceiver& link)
|
|||||||
|
|
||||||
case AS_GET_DRIVER_PATH:
|
case AS_GET_DRIVER_PATH:
|
||||||
{
|
{
|
||||||
int32 index;
|
screen_id id;
|
||||||
fLink.Read<int32>(&index);
|
fLink.Read<screen_id>(&id);
|
||||||
|
|
||||||
BString path;
|
BString path;
|
||||||
status_t status = fDesktop->HWInterface()->GetDriverPath(path);
|
status_t status = fDesktop->HWInterface()->GetDriverPath(path);
|
||||||
|
|||||||
Reference in New Issue
Block a user