Commit a33baff1 authored by Michael Gerbracht's avatar Michael Gerbracht Committed by ROOL

Don't rely on potentially stale handle

Detail:
  GetObjectState is now calling Wimp_GetWindowState using the Wimp handle instead of relying on ScaleInternal_IsShowing whose status may be delayed. ScaleInternal_IsShowing is only set if ToolboxShowObject was successful.

Version 0.17. Tagged as 'Scale-0_17'
parent d5c9dc88
/* (0.16)
/* (0.17)
*
* This file is automatically maintained by srccommit, do not edit manually.
* Last processed by srccommit version: 1.1.
*
*/
#define Module_MajorVersion_CMHG 0.16
#define Module_MajorVersion_CMHG 0.17
#define Module_MinorVersion_CMHG
#define Module_Date_CMHG 18 Aug 2015
#define Module_Date_CMHG 13 Feb 2021
#define Module_MajorVersion "0.16"
#define Module_Version 16
#define Module_MajorVersion "0.17"
#define Module_Version 17
#define Module_MinorVersion ""
#define Module_Date "18 Aug 2015"
#define Module_Date "13 Feb 2021"
#define Module_ApplicationDate "18-Aug-15"
#define Module_ApplicationDate "13-Feb-21"
#define Module_ComponentName "Scale"
#define Module_ComponentPath "castle/RiscOS/Sources/Toolbox/Scale"
#define Module_FullVersion "0.16"
#define Module_HelpVersion "0.16 (18 Aug 2015)"
#define Module_LibraryVersionInfo "0:16"
#define Module_FullVersion "0.17"
#define Module_HelpVersion "0.17 (13 Feb 2021)"
#define Module_LibraryVersionInfo "0:17"
......@@ -183,9 +183,11 @@ _kernel_oserror *show_actual (void) {
debug_output ("a","\n");
}
}
global_next->flags |= ScaleInternal_IsShowing;
e = _kernel_swi (Toolbox_ShowObject, &regs, &regs);
if (e == NULL) {
global_next->flags |= ScaleInternal_IsShowing;
}
if (show_info) {
mem_freek (show_info);
......
......@@ -76,6 +76,7 @@ extern _kernel_oserror *create_object (_kernel_swi_regs *r, TaskDescriptor *t)
_kernel_oserror *e;
_kernel_swi_regs regs,
win_regs,
*user_regs = (_kernel_swi_regs *) r->r[4];
ObjectTemplateHeader *obj_temp_hdr = (ObjectTemplateHeader *) user_regs->r[1];
ScaleTemplate *template = (ScaleTemplate *) obj_temp_hdr->body;
......@@ -144,6 +145,12 @@ extern _kernel_oserror *create_object (_kernel_swi_regs *r, TaskDescriptor *t)
= ((template->flags & Scale_GenerateShowEvent) ? ScaleInternal_GenerateShowEvent : 0)
| ((template->flags & Scale_GenerateHideEvent) ? ScaleInternal_GenerateHideEvent : 0);
win_regs.r[0] = 0;
win_regs.r[1] = internal->sub_object_id;
win_regs.r[2] = internal->wimp_handle;
if ((e = _kernel_swi (Window_GetWimpHandle, &regs, &regs)) != NULL)
return e;
if (t->object_list) { /* If there are already fileinfos attached to the task ... */
internal->forward = t->object_list;
......
......@@ -59,9 +59,22 @@ extern _kernel_oserror *getstate_object (_kernel_swi_regs *r, TaskDescriptor *t)
*
*/
_kernel_oserror *e;
_kernel_swi_regs regs;
wimp_GetWindowState state;
ScaleInternal *internal = (ScaleInternal *) r->r[2];
if (internal->wimp_handle) {
state.open.window_handle = internal->wimp_handle;
regs.r[1] = (int) &state;
if ((e = _kernel_swi (Wimp_GetWindowState, &regs, &regs)) != NULL)
return e;
r->r[0] = (state.flags & wimp_WINDOWFLAGS_OPEN) ? Toolbox_GetObjectState_Showing : 0;
} else {
r->r[0] = (internal->flags & ScaleInternal_IsShowing) ? Toolbox_GetObjectState_Showing : 0;
}
IGNORE(t);
......
......@@ -44,6 +44,7 @@ typedef struct _scale_internal {
int show_type;
ShowInfo *show_info;
ObjectID object_id, sub_object_id;
int wimp_handle;
int std_value[4];
int ini_value; /* contains value when scale was opened */
} ScaleInternal;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment