i have a problem debugging my code. In some Qt Slot i do this:
UIElementInterface* interface = qobject_cast <UIElementInterface*>(sender());
and the following line gives me a segmentation fault:
QStringList data = interface->getSetDefData();
this doesn't
QString hello = interface->getHello();
The implementation of getSetDefData() inside of UIElementInterface:
class UIElementInterface
{
public:
    ...
    UIElementInterface(const QStringList& data) : m_setDefData(data)
    {
        std::cout << qPrintable(m_setDefData[0]) << std::endl; //everything as expected here..
    }
    QStringList getSetDefData(){return m_setDefData;} //gives seg fault
    QString getHello(){return QString("Hello");} //works fine
private:
    QStringList m_setDefData;
};
I would appreciate any help on this one :)
EDIT
Based on the comments i used qobject_cast to cast to a CheckBox, which definitely is the sender (in the case of the crash) and It is a subclassed QCheckBox. So it definitely ihnerits QObject (i also double checked the implementation). When I check the return value as suggested it turns out to be 0.
CheckBox* b = qobject_cast<CheckBox*>(sender());
if (b == 0)
{
    std::cout << "Here we are" << std::endl;
}
so that is the problem. I still need to figure out why this is, but this probably causes the crash.
ANOTHER EDIT Printing out the class name sender()->metaObject()->className() exposed the root of evil:
QSignalMapper
Case closed :)
 
    