summaryrefslogtreecommitdiffstats
path: root/clients/tde/src/app
diff options
context:
space:
mode:
Diffstat (limited to 'clients/tde/src/app')
-rw-r--r--clients/tde/src/app/remotemdi.cpp11
-rw-r--r--clients/tde/src/app/views/instrumentview.cpp28
-rw-r--r--clients/tde/src/app/views/instrumentview.h5
3 files changed, 35 insertions, 9 deletions
diff --git a/clients/tde/src/app/remotemdi.cpp b/clients/tde/src/app/remotemdi.cpp
index 11ab75e..3ecf181 100644
--- a/clients/tde/src/app/remotemdi.cpp
+++ b/clients/tde/src/app/remotemdi.cpp
@@ -343,7 +343,12 @@ void RemoteMDI::childWindowCloseRequest(KMdiChildView *pWnd) {
// Give the child a chance to finish what it was doing and exit cleanly (i.e. without crashing!)
iview->closeConnections();
iview->hide();
- KMdiMainFrm::childWindowCloseRequest(pWnd);
+
+ // RAJA FIXME
+ // Executing KMdiMainFrm::childWindowCloseRequest(pWnd) here will probably cause a crash
+ // We need to call this AFTER control has been returned to the main event loop at least once
+ // This is related to my lack of proper returning to the event loop, which MUST BE FIXED
+// KMdiMainFrm::childWindowCloseRequest(pWnd); // RAJA UNCOMMENT ME
}
}
@@ -363,11 +368,11 @@ void RemoteMDI::closeSpecifiedWindow(KMdiChildView *window) {
if (window) {
// Notify the status bar of the removal of the window
statusBar()->message(i18n("%1 removed").arg(window->tabCaption()));
-
+
// We could also call removeWindowFromMdi, but it doesn't delete the
// pointer. This way, we're sure that the view will get deleted.
closeWindow(window);
-
+
// Synchronize combo box
if (m_pCurrentWindow) {
currentChanged(m_pCurrentWindow);
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;
}
/**********************************************
diff --git a/clients/tde/src/app/views/instrumentview.h b/clients/tde/src/app/views/instrumentview.h
index c9df8d2..64d4d5d 100644
--- a/clients/tde/src/app/views/instrumentview.h
+++ b/clients/tde/src/app/views/instrumentview.h
@@ -26,14 +26,15 @@ class InstrumentView : public KMdiChildView
void closeConnections();
protected:
- virtual void saveProperties( KConfig * );
- virtual void readProperties( KConfig * );
+ virtual void saveProperties(KConfig *);
+ virtual void readProperties(KConfig *);
virtual bool queryExit();
private:
void init();
TQString m_libraryName;
RemoteLab::InstrumentPart *m_instrumentPart;
+ bool* m_canary;
};
} // namespace RemoteLab