Skip to content

Commit

Permalink
Merge pull request #256 from fixstars/fix/graph-auto-disposer
Browse files Browse the repository at this point in the history
fix error on dispose using graph api
  • Loading branch information
iitaku authored Mar 11, 2024
2 parents 3ef4170 + b4e97e3 commit 2a74147
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 10 deletions.
5 changes: 2 additions & 3 deletions include/ion/graph.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,13 @@ namespace ion {
class Builder;

class Graph {
public:

struct Impl;

public:

Graph();

Graph(Builder builder, const std::string& name = "");
Graph(Builder & builder , const std::string& name = "");

Graph& operator+=(const Graph& rhs);

Expand Down
11 changes: 4 additions & 7 deletions src/graph.cc
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
namespace ion {

struct Graph::Impl {
Builder builder;
Builder & builder;
std::string name;
GraphID id;
std::vector<Node> nodes;
Expand All @@ -17,10 +17,8 @@ struct Graph::Impl {
std::unique_ptr<Halide::JITUserContext> jit_ctx;
Halide::JITUserContext* jit_ctx_ptr;
std::vector<const void*> args;
Impl()
: id(sole::uuid4().str())
{}
Impl(Builder b, const std::string& n)

Impl(Builder & b, const std::string& n)
: id(sole::uuid4().str()), builder(b), name(n), jit_ctx(new Halide::JITUserContext), jit_ctx_ptr(jit_ctx.get())
{
}
Expand All @@ -30,7 +28,7 @@ Graph::Graph()
{
}

Graph::Graph(Builder builder, const std::string& name)
Graph::Graph(Builder & builder, const std::string& name)
: impl_(new Impl(builder, name))
{
}
Expand All @@ -52,7 +50,6 @@ Graph operator+(const Graph& lhs, const Graph& rhs)
Node Graph::add(const std::string& name)
{
auto n = impl_->builder.add(name,impl_->id);

impl_->nodes.push_back(n);
return n;
}
Expand Down

0 comments on commit 2a74147

Please sign in to comment.