Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Segmentation fault while debugging in Toolbar creaton [solved]
Forum Update on Monday, May 27th 2025

Segmentation fault while debugging in Toolbar creaton [solved]

Scheduled Pinned Locked Moved General and Desktop
4 Posts 2 Posters 1.0k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    Amry
    wrote on last edited by
    #1

    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.

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      Is openAction initialized ?

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • A Offline
        A Offline
        Amry
        wrote on last edited by
        #3

        Hi,

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

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          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 :)

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          0

          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved