Unsolved MainWindow show crashed after import some static-lib in the same project.
-
Here's the problem. I created a project include some subdirs to generate static-libs and an application. After all subdirs finished, I wrote a test program to check static-libs, and it works well. But After added some UI code, it crashed at show(), I got Sementation Fault from the os. Even I didn't use any funtion from these static-libs, if I delete show(), it worked well again.
I use gdb to run the application, it tells "reveived signal SIGSEGV, Segmentation fault. 0x00007f07b096bb81 in ??() from /usr/lib/x86_64-linux-gnu/libLLVM-9.so.1"
I remote to server and display by X11.
Here's the code.mainwindow.h
#ifndef MAINWINDOW_H #define MAINWINDOW_H #include <QMainWindow> QT_BEGIN_NAMESPACE namespace Ui { class MainWindow; } QT_END_NAMESPACE class MainWindow : public QMainWindow { Q_OBJECT public: MainWindow(QWidget *parent = nullptr); ~MainWindow(); private: Ui::MainWindow* ui; }; #endif // MAINWINDOW_H
mainwindow.cpp
#include "mainwindow.h" #include "ui_mainwindow.h" MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent) , ui(new Ui::MainWindow) { ui->setupUi(this); } MainWindow::~MainWindow() { delete ui; }
main.cpp
#include "mainwindow.h" #include <QApplication> int main(int argc, char *argv[]) { QApplication a(argc, argv); MainWindow w; w.show(); return a.exec(); }
All these code create by default. I changed nothing
I found a bug report:QTBUG-48875, but I it did'n work for me.OS: Ubuntu 20.04
Qt: 5.12.8
GCC: 9.3
Qt Creator: 4.11 -
Hi - I tried your program under Windows 10, and it runs fine.
I realize this doesn't answer your question, but have you considered updating your Qt library?
-
Hi @mzimmers , Thanks for your test.
I have no license to update Qt library, because other guys of the company is also using the same development environment.
I just set static-lib path in .pro file and it run crashed. I have no idea to find the reason. -
@KeithMaybe Did you try to run it through debugger and check the stack trace?
-
Thanks @jsulm .
I did. I found the reason finally. Some guys operator new/delete to replace defualt new/delete, when I created an object it crashed!
My problem solved. -
@KeithMaybe Please mark thread as solved