diff options
Diffstat (limited to 'clients/tde/src/app/views/instrumentview.cpp')
-rw-r--r-- | clients/tde/src/app/views/instrumentview.cpp | 28 |
1 files changed, 24 insertions, 4 deletions
diff --git a/clients/tde/src/app/views/instrumentview.cpp b/clients/tde/src/app/views/instrumentview.cpp index 68b469a..ca3c853 100644 --- a/clients/tde/src/app/views/instrumentview.cpp +++ b/clients/tde/src/app/views/instrumentview.cpp @@ -15,6 +15,7 @@ InstrumentView::InstrumentView(const TQString &library, TQWidget *parentWidget, : KMdiChildView(parentWidget, name, f) , m_libraryName(library) , m_instrumentPart( 0 ) + , m_canary( NULL ) { init(); } @@ -23,12 +24,15 @@ InstrumentView::InstrumentView(const TQString &library, const TQString &caption, : KMdiChildView(caption, parentWidget, name, f) , m_libraryName(library) , m_instrumentPart( 0 ) + , m_canary( NULL ) { init(); } InstrumentView::~InstrumentView() { - // + if (m_canary) { + *m_canary = true; + } } void InstrumentView::init() { @@ -44,10 +48,13 @@ void InstrumentView::init() { } bool InstrumentView::queryExit() { - if( !m_instrumentPart ) //apparently std::exit() still calls this function, and abort() causes a crash.. + if (!m_instrumentPart) { // apparently std::exit() still calls this function, and abort() causes a crash.. return true; + } +printf("[RAJA DEBUG 700.0] In InstrumentView::queryExit\n\r"); fflush(stdout); m_instrumentPart->closeURL(); +printf("[RAJA DEBUG 700.1] In InstrumentView::queryExit\n\r"); fflush(stdout); return true; } @@ -57,11 +64,24 @@ void InstrumentView::closeConnections() { } void InstrumentView::connectServer(TQString server) { + if (!m_canary) { + m_canary = new bool; + *m_canary = false; + } + bool* canary = m_canary; + if (m_instrumentPart) { - if (m_instrumentPart->openURL(KURL(server))) { - close(); + if (m_instrumentPart->openURL(KURL(server))) { // This can call processEvents, therefore this object may not exist when it returns! + if (*canary == true) { + delete canary; + return; + } + TQTimer::singleShot(0, this, SLOT(close())); } } + + delete m_canary; + m_canary = NULL; } /********************************************** |