Jump to content

2.18.1 Possible resource leak in WidgetCanvas


photo

Recommended Posts

Hey everybody! I have a feeling that WidgetCanvas might not properly free the resources used when assigning an Image to a polygon. We have some UnigineScript (I know! We really need to move away from it...) that looked something like this:

class Foo
{
private:
    WidgetCanvas m_canvas = 0;
    Image        m_image  = 0;
    
public:
    Foo(string filename)
    {
        // <some code here to construct m_canvas and create a polygon>
        m_image = new Image(filename);
        m_canvas.setPolygonImage(polygon_id, m_image);
    }

    ~Foo()
    {
        delete m_canvas;
        delete m_image;
    }
};

And it seemed like we kept leaking resources until we added m_canvas.clear() to the destructor.

I can probably put together a proper example if needed, but hopefully it's something really obvious in the source. Fingers crossed.

Link to comment
×
×
  • Create New...