Store IntrusivePtrs in Frame

This commit is contained in:
Jon Siwek 2020-05-22 23:42:42 -07:00
parent 272db640aa
commit 1c617c4f7a
2 changed files with 23 additions and 36 deletions

View file

@ -11,6 +11,7 @@
#include <string>
#include <utility>
#include <vector>
#include <memory>
#include <broker/data.hh>
#include <broker/expected.hh>
@ -41,7 +42,7 @@ public:
* @param n the index to get.
* @return the value at index *n* of the underlying array.
*/
Val* NthElement(int n) const { return frame[n]; }
Val* NthElement(int n) const { return frame[n].get(); }
/**
* Sets the element at index *n* of the underlying array
@ -81,12 +82,6 @@ public:
*/
void Reset(int startIdx);
/**
* Resets all of the values in the frame and clears out the
* underlying array.
*/
void Release();
/**
* Describes the frame and all of its values.
*/
@ -269,7 +264,7 @@ private:
bool delayed;
/** Associates ID's offsets with values. */
Val** frame;
std::unique_ptr<IntrusivePtr<Val>[]> frame;
/** Values that are weakly referenced by the frame. Used to
* prevent circular reference memory leaks in lambda/closures */