I have added a image (tiled) as a background to a class inheriting from wxPanel
Inside the constructor, the second line below is causing memory leakage, (reported in debug mode)
wxImage bg(_("images/textures/icobbg8.jpg"), wxBITMAP_TYPE_JPEG);
SetBackgroundBitmap(wxBitmap(bg));
If i comment the SetBackgroundBitmap memory leak is no longer reported.
Note – During debugging, and after viewing call stack i rounded on this statement.
Please tell me, how to overcome memory leak.
Your should call
SetBackgroundBitmap(wxNullBitmap)in your destructor