title: Issues with modifying a vector of pointers
body: <p>I am having some memory problems while trying to update some objects. </p>
  
  <p>First I call setup(), which is working just fine, but when I call update(), I get bad access errors, which I have a feeling might be an issue with something I have already read: I am modifying a copy, not the actual pointer. I have explored using double pointers for that function, but I can't seem to wrap my mind around it. Does anyone have some advice?</p>
  
  <pre><code>class ofxGrowth {
       ofxGrowthNode * root;
       vector&lt;unique_ptr&lt;ofMesh&gt;&gt; meshes;
  
       void setup();
       void setupMesh(ofxGrowthNode * temp_node, ofMesh * temp_mesh, int mesh_node_id, bool share_root);
       void update();
       void updateMesh(ofxGrowthNode * temp_node, ofMesh * temp_mesh, int mesh_node_id, int current_mesh);
  
       ofxGrowth();
      ~ofxGrowth();
  }
  
  //--------------------------------------------------------------
  //setup creates the mesh system, which is working properly
  //--------------------------------------------------------------
  void ofxGrowth::setup(){
      root = new ofxGrowthNode(*this);
      num_nodes = 0;
  
      unique_ptr&lt;ofMesh&gt; mesh = make_unique&lt;ofMesh&gt;();
      mesh-&gt;setMode(OF_PRIMITIVE_LINE_STRIP);
  
      meshes.push_back(std::move(mesh));
  
      setupMesh(root, meshes.back().get(),0,false);
  }
  
  //--------------------------------------------------------------
  void ofxGrowth::setupMesh(ofxGrowthNode * temp_node, ofMesh * temp_mesh, int mesh_node_id, bool share_root){
      temp_mesh-&gt;addVertex(temp_node-&gt;location);
      temp_mesh-&gt;addIndex(mesh_node_id);
      temp_mesh-&gt;addColor(ofFloatColor(1,0,0));
  
      for(int i = 0; i &lt; temp_node-&gt;children.size(); i++){
          if(i &gt; 0){
              unique_ptr&lt;ofMesh&gt; new_mesh = make_unique&lt;ofMesh&gt;();
              new_mesh-&gt;setMode(OF_PRIMITIVE_LINE_STRIP);
              new_mesh-&gt;addVertex(temp_node-&gt;location);
              new_mesh-&gt;addIndex(0);
  
              new_mesh-&gt;addColor(ofFloatColor(0,1,0));
  
              temp_mesh = new_mesh.get();
              meshes.push_back(move(new_mesh));
              mesh_node_id = 0;
          }
  
          mesh_node_id++;
  
          temp_node = temp_node-&gt;children[i].get();
          setupMesh(temp_node, temp_mesh, mesh_node_id, share_root);
      }
  }
  
  //--------------------------------------------------------------
  //update is meant to re-traverse the meshes, updating the
  //--------------------------------------------------------------
  void ofxGrowth::update(){
      updateMesh(root, meshes[0].get(),0,0);
  }
  
  //--------------------------------------------------------------
  void ofxGrowth::updateMesh(ofxGrowthNode * temp_node, ofMesh * temp_mesh, int mesh_node_id, int current_mesh){
      temp_mesh-&gt;setVertex(mesh_node_id, temp_node-&gt;location);
      temp_mesh-&gt;setColor(mesh_node_id, ofFloatColor(1,0,0));
  
      for(int i = 0; i &lt; temp_node-&gt;children.size(); i++){
          if(i &gt; 0){
              temp_mesh = meshes[current_mesh + 1].get();
  
              current_mesh = current_mesh + 1;
              mesh_node_id = 0;
          }
  
          mesh_node_id++;
  
          temp_node = temp_node-&gt;children[i].get();
          updateMesh(temp_node, temp_mesh, mesh_node_id, current_mesh);
      }
  }
  </code></pre>