menuitem->setEnabled() segv

  • I have a main window with a layout. in the layout are 2 widgets. During my mainwindow initialisation i create the widgets, add them to the layout and call centralwidget() on the Layout.
    The last thing I do in my mainwindow init is to disable practically all menu items except file/new. This all works as expected.

    As part of file/new method I enable all relevant menuitems via setEnabled(true). Each one of these calls causes a segv for no apparent reason -- no additional debug info, debug console messaging or messages from static_assert are printed.

    What is causing this?

  • Lifetime Qt Champion

    Have you tried to single step it to see if somehow you have infinite recursions?
    Else its hard to imagine what could make it
    crash since i assume it cant be a dangling pointer or the normal suspects.

  • ok I will follow up on that advice.


  • @QtUsr001
    I would like a written guarantee from you as to what menuitem is pointing to when you go menuitem->setEnabled() :)

    I wouldn't expect a debug message for this, just a SEGV. But you should be able to sit in the debugger and break/traceback on the statement to see what it tells you *menuitem looks like.

Log in to reply