documentation error?: wxImage::RemoveHandler

If you are using the main C++ distribution of wxWidgets, Feel free to ask any question related to wxWidgets development here. This means questions regarding to C++ and wxWidgets, not compile problems.
Post Reply
User avatar
Disch
Experienced Solver
Experienced Solver
Posts: 99
Joined: Wed Oct 17, 2007 2:01 am

documentation error?: wxImage::RemoveHandler

Post by Disch »

I'm using wxWidgets 2.8.6 on Windows 2000. wxImage::RemoveHandler documentation indicates the following:
Finds the handler with the given name, and removes it. The handler is not deleted.
Yet I ran into problems using it -- and after tracing found that it is actually deleteing the handler:

image.cpp line 2319

Code: Select all

bool wxImage::RemoveHandler( const wxString& name )
{
    wxImageHandler *handler = FindHandler(name);
    if (handler)
    {
        sm_handlers.DeleteObject(handler);
        delete handler;      //  <---  deleting!
        return true;
    }
    else
        return false;
}
I confirmed that the object it's deleting is in fact the same as the object my program allocated (it's not a seperate copy).

Is that delete line erroneous? Should I remove it and recompile? Or is the documentation incorrect? I'd hate to remove the delete in my program only to suffer from memory leaks when I compile for other platforms.
Auria
Site Admin
Site Admin
Posts: 6695
Joined: Thu Sep 28, 2006 12:23 am
Contact:

Post by Auria »

Hi,

this is mostly a support forum, for questions regarding the internals of wx you're probably better on the amiling lists and bug tracker (and i would say bug tracker cause it really seems to be deleting it)
Post Reply