Skip to content

Commit

Permalink
Fix for reload crash on ATS 7.
Browse files Browse the repository at this point in the history
  • Loading branch information
SolidWallOfCode committed Mar 29, 2020
1 parent 45f733d commit 7a2bb60
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion plugin/src/txn_box_remap.cc
Original file line number Diff line number Diff line change
Expand Up @@ -91,14 +91,26 @@ class RemapConfig {
RemapConfig* RemapConfig::_instance = nullptr;

RemapConfig::self_type &RemapConfig::acquire() {
#if TS_VERSION_MAJOR < 8
// pre-8, there's no general reload signal, so must just have a separate instance for each
// rule.
auto self = new self_type;
++(self->_ref_count);
return *self;
#else
if (nullptr == _instance) {
_instance = new self_type;
}
++(_instance->_ref_count);
return *_instance;
#endif
}

void RemapConfig::release() { if (--_ref_count == 0) { delete this; } }
void RemapConfig::release() {
if (--_ref_count == 0) {
delete this;
}
}

void RemapConfig::clear() { _instance = nullptr; }

Expand Down

0 comments on commit 7a2bb60

Please sign in to comment.