Skip to content

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

@zhangew

Description

@zhangew

Hi,

I noticed an runtime exception that raised in ofURLFileLoaderImpl::update(), after I finished a correct downloading process and deleted the ofURLFileLoader instance 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 a bug? So I've tried using ofURLFileLoader as singleton, and no error occurs, and it can also explains 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 thread 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