Segmentation fault while debugging in Toolbar creaton [solved]



  • I am trying to build MainWindow with some toolbars and menus. So in my mainwindow.h I have private variables QToolbar * filetBar; And in .cpp file, I am calling: createToolbars which is:
    @
    void MainWindow::createToolbars()
    {
    filetBar = addToolBar(tr("&File"));
    filetBar->addAction(openAction);

    }
    

    @
    When I run, it just says The program has unexpectedly finished. When I run it with debugger is gives me

    Signal name : SIGSEGV Signal meaning : Segmentation fault ad line

    @ filetBar->addAction(openAction); @

    I create menus similarly:

    @ void MainWindow::createMenus()
    {
    fileMenu = menuBar()->addMenu(tr("&File"));
    fileMenu->addAction(openAction);
    }
    @

    It show menus, and actions are working. Any idea how can I fix it? Thanks.


  • Lifetime Qt Champion

    Hi,

    Is openAction initialized ?



  • Hi,

    I have found a bug, it is working,
    Thanks.


  • Lifetime Qt Champion

    Glad you found out !

    Then since it's working now, please update the thread title prepending [solved] so other forum users may know a solution has been found :)


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.