I just seen there is already something prevPrim_ = prim; in SubmitPrim(). May be better put there .