Skip to content

Commit 83a5644

Browse files
[[ Bug 13453 ]] variable watch not working
1 parent f008469 commit 83a5644

File tree

3 files changed

+17
-13
lines changed

3 files changed

+17
-13
lines changed

docs/notes/bugfix-13453.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# variable watch not working

engine/src/debug.cpp

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -672,29 +672,32 @@ void MCB_parsewatches(MCExecContext& ctxt, MCStringRef p_input)
672672
if (t_success)
673673
t_success = MCStringDivideAtChar(*t_watch, ',', kMCCompareExact, &t_obj, &t_obj_tail);
674674

675-
MCAutoStringRef t_express;
676-
MCAutoStringRef t_express_tail;
675+
// SN-2014-09-18: [[ Bug 13453 ]] The input is object, handler, variable, condition
676+
MCAutoStringRef t_hname;
677+
MCAutoStringRef t_hname_tail;
677678

678679
if (t_success)
679-
t_success = MCStringDivideAtChar(*t_obj_tail, ',', kMCCompareExact, &t_express, &t_express_tail);
680+
t_success = MCStringDivideAtChar(*t_obj_tail, ',', kMCCompareExact, &t_hname, &t_hname_tail);
680681

681682
MCAutoStringRef t_vname;
682-
MCAutoStringRef t_hname;
683+
MCAutoStringRef t_express;
683684

684685
if (t_success)
685-
t_success = MCStringDivideAtChar(*t_express_tail, ',', kMCCompareExact, &t_vname, &t_hname);
686+
t_success = MCStringDivideAtChar(*t_hname_tail, ',', kMCCompareExact, &t_vname, &t_express);
686687

687688
MCObjectPtr t_object;
688689

690+
// SN-2014-09-18: [[ Bug 13453 ]] With an empty string (no watchedVariables anymore), TryToResolveObject fails
689691
if (t_success)
690-
{
691-
MCInterfaceTryToResolveObject(ctxt, *t_obj, t_object);
692-
692+
t_success = MCInterfaceTryToResolveObject(ctxt, *t_obj, t_object);
693+
694+
if (t_success)
695+
{
693696
// OK-2010-01-14: [[Bug 6506]] - Allow globals in watchedVariables
694697
// If the object and handler are empty we assume its a global, otherwise
695698
// do the previous behavior.
696699

697-
if (MCStringGetLength(*t_obj) == 0 && MCStringGetLength(*t_hname) == 0 ||
700+
if ((MCStringGetLength(*t_obj) == 0 && MCStringGetLength(*t_hname) == 0) ||
698701
t_object . object != nil)
699702
{
700703
Watchvar *t_new_watches;
@@ -754,10 +757,9 @@ bool MCB_unparsewatches(MCStringRef &r_watches)
754757
if (t_success)
755758
t_success = MCListAppend(*t_watched_var, MCwatchedvars[i].varname);
756759

757-
if (t_success && MCwatchedvars[i].expression != nil && !MCStringIsEmpty(MCwatchedvars[i].expression))
758-
{
760+
// SN-2014-09-18: [[ Bug 13453 ]] A watched variable's expression is never nil
761+
if (t_success)
759762
t_success = MCListAppend(*t_watched_var, MCwatchedvars[i].expression);
760-
}
761763

762764
if (t_success)
763765
t_success = MCListAppend(*t_watches_list, *t_watched_var);

engine/src/variable.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -507,7 +507,8 @@ bool MCVariable::give_value(MCExecContext& ctxt, MCExecValue p_value, MCVariable
507507
value = p_value;
508508
}
509509

510-
synchronize(ctxt);
510+
// SN-2014-09-18 [[ Bug 13453 ]] give_value should notify the debugger about it
511+
synchronize(ctxt, true);
511512
return true;
512513
}
513514

0 commit comments

Comments
 (0)