[Qt-interest] crash during QObject::connect

MARTIN Pierre hickscorp at gmail.com
Fri Sep 9 17:06:09 CEST 2011


Hello again Thomas,

> Thanks Martin, answers inline
BTW my first name is Pierre, not Martin :)

> 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
Well, i think you shall provide us a bit more of your source code, or at least a very thin project showing the problem (i'm myself am unable to reproduce it with the same calls).

> Yes, I always check validity of those pointers.
How? If your model got deleted by it's parent earlier, you'll receive a non-null pointer pointing to a deleted memory location (Dangling pointer). There are no ways to check that (Unless you're using guarded pointers, but i doubt it seeing your code, correct me if i'm wrong).

> 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?


i'm not sure i'm following anymore. When does it crashes exactly? Theorically, the "connect" statement cannot make your application "crash" because even if either of your signal / slot specification is wrong, you'll just get a debug message and nothing more.

> In fact, I can say for certain that that signal gets not emitted while I test the app and it crashes.
How can you know the signal isn't emitted? i believe you can tell if your slot gets called, but the emission of a signal is in your moc-generated code. Are you debugging it correctly to assert that it does not emits anything?

Again, i think a bit more of your code would be sufficient to help you further :)




More information about the Qt-interest-old mailing list