getContext() clears "card" from the context

This commit is contained in:
Twan van Laarhoven
2020-04-18 21:34:31 +02:00
parent 9c9eba77a0
commit 332f7b9ed8
2 changed files with 3 additions and 3 deletions
+2 -2
View File
@@ -55,7 +55,7 @@ Set::~Set() {}
Context& Set::getContext() { Context& Set::getContext() {
assert(wxThread::IsMain()); assert(wxThread::IsMain());
return script_manager->getContext(stylesheet); return script_manager->getContext(CardP());
} }
Context& Set::getContext(const CardP& card) { Context& Set::getContext(const CardP& card) {
assert(wxThread::IsMain()); assert(wxThread::IsMain());
@@ -73,7 +73,7 @@ Context& Set::getContextForThumbnails() {
if (!thumbnail_script_context) { if (!thumbnail_script_context) {
thumbnail_script_context.reset(new SetScriptContext(*this)); thumbnail_script_context.reset(new SetScriptContext(*this));
} }
return thumbnail_script_context->getContext(stylesheet); return thumbnail_script_context->getContext(CardP());
} }
Context& Set::getContextForThumbnails(const CardP& card) { Context& Set::getContextForThumbnails(const CardP& card) {
assert(!wxThread::IsMain()); assert(!wxThread::IsMain());
+1 -1
View File
@@ -80,7 +80,7 @@ Context& SetScriptContext::getContext(const CardP& card) {
ctx.setVariable(SCRIPT_VAR_card, to_script(card)); ctx.setVariable(SCRIPT_VAR_card, to_script(card));
ctx.setVariable(SCRIPT_VAR_styling, to_script(&set.stylingDataFor(card))); ctx.setVariable(SCRIPT_VAR_styling, to_script(&set.stylingDataFor(card)));
} else { } else {
ctx.setVariable(SCRIPT_VAR_card, script_nil); ctx.setVariable(SCRIPT_VAR_card, ScriptValueP());
ctx.setVariable(SCRIPT_VAR_styling, to_script(&set.stylingDataFor(*stylesheet))); ctx.setVariable(SCRIPT_VAR_styling, to_script(&set.stylingDataFor(*stylesheet)));
} }
return ctx; return ctx;