Skip to content

Maybe a bug of no corresponding ofRemoveListener for ofURLFileLoaderImpl::start() #8496

@zhangew

Description

@zhangew

Hi,

I noticed a runtime exception that raised in ofURLFileLoaderImpl::update(), after I finished 2 correct downloading processes and deleted the 2 ofURLFileLoader instances in my object.

It seems that the framework was trying to callback the handler(ofURLFileLoaderImpl::update) which has already gone.

So I checked the source code of ofURLFileLoader.cpp, and noticed there is:
void ofURLFileLoaderImpl::start() {
if (!isThreadRunning()) {
ofAddListener(ofEvents().update, this, &ofURLFileLoaderImpl::update);
startThread();
}
}

But there isn't corresponding ofRemoveListener() anywhere.

And it seems to be a bug? So I've tried using ofURLFileLoader as singleton(as static member), and no error occurs, and it can also explain the above source code, the callback does always exist.

Sorry for no call stack info and I have no proper environment for testing the above guess, but if the info helps, it might be fixed after the ofThread ends?

Thanks a lot!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions