Qt-based GUI on worker thread
Posted: Fri Sep 20, 2019 8:18 am
I am currently trying to plot the realtime acquired signals using a Qt-based library called QCustomPlot. I spent some time analyzing what is the best possible approach to achieve this. The most important requirement is to guarantee that the GUI will not influence the realtime acquisition and processing of the audio signals. I decided to implement this using a C++ worker thread in my plugin that takes care of the GUI. I managed to integrate the Qt-based plotting library successfully. However, I haven't managed to get it running in the background. I am running this piece of code inside the prepare method of my plugin:
Unfortunately, I've been stuck for some time now due to a segmentation fault:
I wanted to ask for some opinions and advise about the approach I chose to solve this problem. Do you think I'm going in the right direction? Is there another much better approach and easier to implement than the one I'm currently striving for? If you need extra information please let me know. Thanks in advance!
Code: Select all
int argc = 0;
char **argv = NULL;
std::thread t1
(
[&] {
QApplication application(argc, argv);
MainWindow mainWindow;
mainWindow.show();
return application.exec();
}
);
t1.detach();
Code: Select all
Process finished with exit code 139 (interrupted by signal 11: SIGSEGV)