Skip to content

Commit

Permalink
fix #23: pointer to a local variable memory structure
Browse files Browse the repository at this point in the history
  • Loading branch information
jsenellart committed Mar 21, 2023
1 parent 5ed9ac5 commit 4f7a63f
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions camfr/waveguide.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,12 @@ class Waveguide
public:

Waveguide(bool uniform_=false, Material* core_=NULL)
: uniform(uniform_), core(core_) {}
: uniform(uniform_), core(new Material(*core_)) {}

virtual ~Waveguide() {interface_cache.deregister(this);} // Important!
virtual ~Waveguide() {
delete core;
interface_cache.deregister(this); // Important!
}

bool is_uniform() const {return uniform;}
Material* get_core() const {return core;}
Expand Down

0 comments on commit 4f7a63f

Please sign in to comment.