Hi all!

There is a problem with MaterialDrawable::setMaterial.
Let's say we are doing something like this:

--cut----------------------------
GeometryPtr geo = Geometry::create();
MaterialDrawablePtr md = MaterialDrawablePtr::dcast(geo);
beginEditCP(md);
  md->setMaterial(myGlobalMaterial);
endEditCP(md);
--cut----------------------------

The problem with this code is that MaterialDrawable::setMaterial won't call addRefCP on myGlobalMaterial. But the destructor of Geometry calls subRefCP on the material. That produces a crash when deleting the scene graph which is nice to debug...

possible Solutions are:
(1) The setMaterial method of MaterialDrawable becomes virtual.
  or
(2) The setMaterial method of MaterialDrawable calls setRefdCP.


Regards,

Joerg.

Attachment: smime.p7s
Description: S/MIME Cryptographic Signature

Reply via email to