[SOLVED] Removing .ui form leads to segmentation fault



  • HI all,

    I' trying to remove the .ui form and all its associates pointer from the .h and .cpp file. After removing them, I ran qmake and rebuild the project. However, when I Run the project, the program end unexpectedly. I tried debugging by putting breakpoints, but it did not even enter the main function.

    Am I missing any step in removing the ui file? Thanks in advance.


  • Lifetime Qt Champion

    Hi,

    You should rather delete your build directory when doing that.



  • Hi,

    Remove the .ui name from the * .pro* file.

    Ex: FORMS +=
    topmenu.ui
    welcomescreen.ui
    inputrecordrange.ui
    inputtabularrange.ui
    about.ui

    in above case if you have deleted about.ui & inputrecordrange.ui, you just remove the names from FORMS

    FORMS +=
    topmenu.ui
    welcomescreen.ui
    inputtabularrange.ui



  • Hi,

    Thanks SGaist. Deleting the whole build directory helped me to solve that problem. And yes Pradeep, I did removed the .ui file before too. But that alone didn't help.

    One thing to note though; after deleting the build directory, I still had segmentation fault which is caused by the code below:

    @QHBoxLayout *layout = new QHBoxLayout;
    this->centralWidget()->setLayout(layout);
    @

    So I changed it to this:

    @QHBoxLayout layout = new QHBoxLayout;
    QWidget
    w = new QWidget;
    w->setLayout(layout);
    this->setCentralWidget(w);
    @


  • Lifetime Qt Champion

    You're welcome !

    By default there's no central widget, hence the crash.



  • So I believe the code didn't crash when I was initially using the form as the form provides a default central widget.


  • Lifetime Qt Champion

    You're right

    Since you have it 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.