Skip to content

Commit

Permalink
Comments out Alert()/DebugBreak() for non-MQL
Browse files Browse the repository at this point in the history
  • Loading branch information
kenorb committed Jul 27, 2024
1 parent 80672f1 commit eb38f88
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions Std.h
Original file line number Diff line number Diff line change
Expand Up @@ -406,6 +406,7 @@ struct AsSeriesReleaseEnsurer {
AsSeriesReleaseEnsurer(int _num_buffs) : released(false), num_buffs(_num_buffs) {}
void done(int _num_buffs) {
if (_num_buffs != num_buffs) {
#ifdef __MQL__
Alert("You have acquired ", num_buffs, " buffers via ACQUIRE_BUFFER", num_buffs,
"(), but now trying to release with mismatched RELEASE_BUFFER", _num_buffs, "()!");
DebugBreak();
Expand All @@ -415,15 +416,18 @@ struct AsSeriesReleaseEnsurer {
Alert("You have used RELEASE_BUFFER", num_buffs, "() again which is not required!");
DebugBreak();
}
#endif

released = true;
}
~AsSeriesReleaseEnsurer() {
#ifdef __MQL__
if (!released) {
Alert("You have used ACQUIRE_BUFFER", num_buffs, "() but didn't release buffer(s) via RELEASE_BUFFER", num_buffs,
"() before returning from the scope!");
DebugBreak();
}
#endif
}
};

Expand Down

0 comments on commit eb38f88

Please sign in to comment.