mercredi 27 juillet 2016

Plugin exposing member `QWidget` result in pointer being freed was not allocated

I'm trying to develop a plugin which exposes a QWidget (more details here), it's interface has something like:

virtual QWidget *panel() = 0;

While in the implementation I tried:

QWidget *BPlugin::widget() {
    return &m_widget;
}

This gives an error, app crashes on close:

malloc: *** error for object 0x7f9db24c3f78: pointer being freed was not allocated

Instead, allocating QWidget with new works fine. But using new these days isn't that popular anymore. Should I use new anyway when dealing with plugins?

Aucun commentaire:

Enregistrer un commentaire