Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/complexplot/ComplexplotWrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@ ComplexplotWrapper::ComplexplotWrapper()

ComplexplotWrapper::~ComplexplotWrapper()
{
if(QCoreApplication::instance() == NULL) {
destroyed_ = true;
}

if(destroyed_)
emit destroyWidgetSignal();
else
Expand Down
4 changes: 4 additions & 0 deletions src/keyvalue/KeyValueWrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@ KeyValueWrapper::KeyValueWrapper()

KeyValueWrapper::~KeyValueWrapper()
{
if(QCoreApplication::instance() == NULL) {
destroyed_ = true;
}

if(destroyed_)
emit destroyWidgetSignal();
else
Expand Down
4 changes: 4 additions & 0 deletions src/realplot/RealplotWrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@ RealplotWrapper::RealplotWrapper()

RealplotWrapper::~RealplotWrapper()
{
if(QCoreApplication::instance() == NULL) {
destroyed_ = true;
}

if(destroyed_)
emit destroyWidgetSignal();
else
Expand Down
4 changes: 4 additions & 0 deletions src/scatterplot/ScatterplotWrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@ ScatterplotWrapper::ScatterplotWrapper()

ScatterplotWrapper::~ScatterplotWrapper()
{
if(QCoreApplication::instance() == NULL) {
destroyed_ = true;
}

if(destroyed_)
emit destroyWidgetSignal();
else
Expand Down
13 changes: 9 additions & 4 deletions src/srsgui++.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,16 @@
#include <unistd.h>

pthread_t threadxx;
QApplication* appxx;
static int sdrgui_initiatedxx=0;

void *qt_threadxx(void *arg)
{
int argc = 1;
char* argv[] = { const_cast<char *>((char*) arg), NULL };
QApplication app(argc, argv);
app.exec();
appxx = new QApplication(argc, argv);
appxx->exec();
delete appxx;
pthread_exit(NULL);
}

Expand Down Expand Up @@ -41,8 +43,11 @@ void sdrgui_exit() {
if(sdrgui_initiatedxx)
{
usleep(100000);
pthread_cancel(threadxx);
if(appxx) {
appxx->quit();
}

pthread_join(threadxx, NULL);
}
}
sdrgui_initiatedxx=0;
}
14 changes: 9 additions & 5 deletions src/srsgui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,16 @@
#include <unistd.h>

pthread_t thread;
QApplication* app;
static int sdrgui_initiated=0;

void *qt_thread(void *arg)
{
int argc = 1;
char* argv[] = { const_cast<char *>((char*) arg), NULL };
QApplication app(argc, argv);
app.exec();
app = new QApplication(argc, argv);
app->exec();
delete app;
pthread_exit(NULL);
}

Expand Down Expand Up @@ -43,8 +45,10 @@ void sdrgui_exit()
if(sdrgui_initiated)
{
usleep(100000);
pthread_cancel(thread);
pthread_join(thread, NULL);
}
if (app) {
app->quit();
}
pthread_join(thread, NULL);
}
sdrgui_initiated=0;
}
4 changes: 4 additions & 0 deletions src/textedit/TextEditWrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@ TextEditWrapper::TextEditWrapper()

TextEditWrapper::~TextEditWrapper()
{
if(QCoreApplication::instance() == NULL) {
destroyed_ = true;
}

if(destroyed_)
emit destroyWidgetSignal();
else
Expand Down
4 changes: 4 additions & 0 deletions src/waterfallplot/WaterfallplotWrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@ WaterfallplotWrapper::WaterfallplotWrapper(int numDataPoints, int numRows)

WaterfallplotWrapper::~WaterfallplotWrapper()
{
if(QCoreApplication::instance() == NULL) {
destroyed_ = true;
}

if(destroyed_)
emit destroyWidgetSignal();
else
Expand Down