Jassert (componentToWatch_->isValidComponent());


#1

Hi,

I’m writing a multithreaded application and have been running into some trouble. Each time my application refreshes, I clear the contents of my main window’s content component. After this, I discover devices on a network. For each device that I discover, I start up a thread which is used to enumerate that discovered device. As the application learns about the capabilities of the devices it has discovered my GUI is updated to reflect these discoveries. I’ve made very sure that all my GUI updating is done on the message thread (my PDC objects use the AsyncUpdater to inform the GUI of their changes).

Often, the following assertion fails:

    // not possible to check on an already-deleted object..
    jassert (componentToWatch_->isValidComponent());

I’m sure that this has something to do with the interaction of the multiple threads. Has anyone else had experience with this assertion failing? Any pointers on why it is actually failing? I often find that this assertion fails when I am creating the components that are to be displayed in my content component.

Philip


#2

Well, something is trying to create a componentdeletionwatcher using a dangling pointer… Surely it’s obvious from the stack trace what’s going on?