[Interest] type casting 5 levels down no error but not proper

Konstantin Tokarev annulen at yandex.ru
Tue Apr 24 14:46:50 CEST 2012


24.04.2012, 16:42, "Sujan Dasmahapatra" <sdh at lmwindpower.com>:
> Thanks Diego and Konstantin for your valuable inputs. I am now doing qobject_cast for all of them, please check the code snippet below, now it’s crashing at tabWid step. It’s giving QASSERT failure. The failure is happening in the following file
>
> //qscopedpointer.h at the following line QASSERT(d)
>
>   inline T *operator->() const
>
>     {
>
>         Q_ASSERT(d); //this line it’s crashing.
>
>         return d;
>
>     }

It means that tabWid is QScopedPointer with 0 value. You need to check if qobject_cast doesn't return 0 before using pointer.

-- 
Regards,
Konstantin



More information about the Interest mailing list