[Qt-interest] crash during QObject::connect

Thomas Ehrnhoefer thomas.ehrnhoefer at tasktop.com
Fri Sep 9 16:53:08 CEST 2011


Thanks Martin, answers inline

On Fri, Sep 9, 2011 at 7:47 AM, MARTIN Pierre <hickscorp at gmail.com> wrote:

> QObject::connect(controller, SIGNAL(onModelChanged(MyModel*)), this,
> SLOT(onModelChanged(MyModel*)),Qt::UniqueConnection);
>
> Why are you specifying Qt::UniqueConnection as your flags?
>

I used to had a problem getting certain signals multiple times, so I made it
a habit to use UniqueConnection, as I did not see any downside in it. In
this case of the crash I tried to remove this already, which didn't make a
difference


> Also, passing pointers with the signals / slots mechanisms has to be done
> with caution... In your receiving object, are you sure the MyModel pointer
> is still valid when the slot gets called?
>
>
Yes, I always check validity of those pointers. But from what I understand
the crash happening when I call connect wont have anything to do with an
actual signal being triggered, or does it? In fact, I can say for certain
that that signal gets not emitted while I test the app and it crashes.


>
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at qt.nokia.com
> http://lists.qt.nokia.com/mailman/listinfo/qt-interest
>
>


-- 
Thomas Ehrnhoefer
Software Developer, http://tasktop.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20110909/d73d627a/attachment.html 


More information about the Qt-interest-old mailing list