]> git.tdb.fi Git - libs/gl.git/blobdiff - source/programdata.cpp
Copy ProgramData::uniform_slots in copy constructor and operator=
[libs/gl.git] / source / programdata.cpp
index 7705fac9786420bf47b5fc02edf088cd54b64ec5..535ade962207103f29fc8db0b87ddefa2551a8cc 100644 (file)
@@ -21,6 +21,7 @@ ProgramData::ProgramData():
 
 // Blocks are intentionally left uncopied
 ProgramData::ProgramData(const ProgramData &other):
+       uniform_slots(other.uniform_slots),
        uniforms(other.uniforms),
        last_block(0),
        buffer(0),
@@ -36,6 +37,7 @@ ProgramData &ProgramData::operator=(const ProgramData &other)
                delete *i;
        uniforms.clear();
 
+       uniform_slots = other.uniform_slots;
        for(vector<Uniform *>::const_iterator i=other.uniforms.begin(); i!=other.uniforms.end(); ++i)
                uniforms.push_back((*i)->clone());
 
@@ -61,6 +63,9 @@ ProgramData::~ProgramData()
 
 void ProgramData::uniform(const string &name, Uniform *uni)
 {
+       if(name[name.size()-1]==']')
+               throw invalid_argument("ProgramData::uniform");
+
        SlotMap::iterator i = uniform_slots.find(name);
        if(i!=uniform_slots.end())
        {