"CustomSlot *CustomSlotObj;" produces nothing but a dangling pointer which points to some random memory garbage. You forgot to actually instantiate something with C++ operator new.