GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — [[ Bug 18899 ]] Make sure current module is updated · livecode/livecode@6e2269c

This repository was archived by the owner on Aug 31, 2021. It is now read-only.

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • libscript/src
    • script-bytecode.hpp
    • script-instance.cpp
    • script-private.h
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎libscript/src/script-bytecode.hpp‎

Copy file name to clipboardExpand all lines: libscript/src/script-bytecode.hpp
+4Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -315,10 +315,12 @@ struct MCScriptBytecodeOp_Invoke
315315
{
316316
case kMCScriptDefinitionKindHandler:
317317
{
318+
MCScriptModuleRef t_previous = MCScriptSetCurrentModule(t_resolved_instance->module);
318319
ctxt.PushFrame(t_resolved_instance,
319320
static_cast<MCScriptHandlerDefinition *>(t_resolved_definition),
320321
t_result_reg,
321322
t_arguments);
323+
MCScriptSetCurrentModule(t_previous);
322324
}
323325
break;
324326

@@ -526,10 +528,12 @@ struct MCScriptBytecodeOp_InvokeIndirect
526528
{
527529
case kMCScriptDefinitionKindHandler:
528530
{
531+
MCScriptModuleRef t_previous = MCScriptSetCurrentModule(t_handler_instance->module);
529532
ctxt.PushFrame(t_handler_instance,
530533
static_cast<MCScriptHandlerDefinition *>(t_handler_def),
531534
p_result_reg,
532535
p_argument_regs);
536+
MCScriptSetCurrentModule(t_previous);
533537
}
534538
break;
535539

Collapse file

‎libscript/src/script-instance.cpp‎

Copy file name to clipboardExpand all lines: libscript/src/script-instance.cpp
+13-2Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626

2727
////////////////////////////////////////////////////////////////////////////////
2828

29-
// This is the module of the most recent LCB stack frame on the current thread's
29+
// This is the module of themost recent LCB stack frame on the current thread's
3030
// stack. It is set before and after a foreign handler call so that the native
3131
// code can get some element of context.
3232
static MCScriptModuleRef s_current_module = nil;
@@ -232,7 +232,9 @@ __MCScriptCallHandlerDefinitionInInstance(MCScriptInstanceRef self,
232232
}
233233
}
234234

235-
MCScriptExecuteContext t_execute_ctxt;
235+
MCScriptModuleRef t_previous = MCScriptSetCurrentModule(self->module);
236+
237+
MCScriptExecuteContext t_execute_ctxt;
236238
t_execute_ctxt.Enter(self,
237239
p_handler_def,
238240
MCMakeSpan(p_arguments, p_argument_count),
@@ -252,6 +254,8 @@ __MCScriptCallHandlerDefinitionInInstance(MCScriptInstanceRef self,
252254
t_cookie);
253255
}
254256
}
257+
258+
MCScriptSetCurrentModule(t_previous);
255259

256260
if (!t_execute_ctxt.Leave())
257261
{
@@ -1277,6 +1281,13 @@ MCScriptModuleRef MCScriptGetCurrentModule(void)
12771281
return s_current_module;
12781282
}
12791283

1284+
MCScriptModuleRef MCScriptSetCurrentModule(MCScriptModuleRef p_module)
1285+
{
1286+
MCScriptModuleRef t_previous = s_current_module;
1287+
s_current_module = p_module;
1288+
return t_previous;
1289+
}
1290+
12801291
////////////////////////////////////////////////////////////////////////////////
12811292

12821293
extern "C" bool MC_DLLEXPORT_DEF MCScriptBuiltinRepeatCounted(uinteger_t *x_count)
Collapse file

‎libscript/src/script-private.h‎

Copy file name to clipboardExpand all lines: libscript/src/script-private.h
+2Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -538,6 +538,8 @@ struct MCScriptInstance: public MCScriptObject
538538
void *host_ptr;
539539
};
540540

541+
MCScriptModuleRef MCScriptSetCurrentModule(MCScriptModuleRef module);
542+
541543
void
542544
MCScriptDestroyInstance(MCScriptInstanceRef instance);
543545

0 commit comments

Comments
0 (0)
You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.