Hello,
does anyone know a way to detect if a pointer to a subclass of QObject or even a QWidget is dangling?
MyWidget w = new MyWidget(parent);
somewhere()
{
delete w;
}
somewhereelse()
{
if (w is not dangling) // <-- how to do this?
do something with w;
}
class MyWidget : public QWidget;
MyWidget w = new MyWidget(parent);
somewhere()
{
delete w;
}
somewhereelse()
{
if (w is not dangling) // <-- how to do this?
do something with w;
}
To copy to clipboard, switch view to plain text mode
I know that you can connect the destroyed() signal, but in my case it's very tiresome. It would be much nicer (and safer) if I could somehow tell by the pointer, if it still points to a valid object or not. Is there such a path to take, oh masters of Qt?
Bookmarks