Permalink
Browse files

qtcollider: only hide windows on language shutdown (do not destroy them)

  • Loading branch information...
1 parent 5ca3c77 commit 500d3d523f5208e8aa4a39d13e7fd128aa79e18f @jleben jleben committed May 4, 2012
Showing with 4 additions and 34 deletions.
  1. +4 −34 QtCollider/LanguageClient.cpp
View
38 QtCollider/LanguageClient.cpp
@@ -28,6 +28,7 @@
#include <PyrLexer.h>
#include <qmath.h>
+#include <QWidget>
extern double elapsedTime();
@@ -118,40 +119,9 @@ void LangClient::onQuit( int exitCode )
void LangClient::onLibraryShutdown()
{
- // NOTE: Finalization does not work properly in sclang:
- // finalizers of still accessible objects are not called at shutdown.
- // Therefore we finalize here manually.
-
- QtCollider::lockLang();
- if(!compiledOK) {
- QtCollider::unlockLang();
- return;
- }
-
- VMGlobals *g = gMainVMGlobals;
-
- // Get the 'heap' classvar of QObject:
- int idx = slotRawInt( &SC_CLASS(QObject)->classVarIndex );
- PyrSlot *heap_slot = slotRawObject( &g->process->classVars )->slots + idx;
-
- if (IsObj(heap_slot))
- {
- // Delete all objects on heap:
- PyrObject *heap = slotRawObject( heap_slot );
- int n = heap->size;
- for(int i = 0; i < n; ++i)
- {
- PyrObject *object = slotRawObject(heap->slots+i);
- QObjectProxy *proxy = static_cast<QObjectProxy*>(slotRawPtr(object->slots));
- proxy->finalize();
- proxy->destroy( QObjectProxy::DestroyObject );
- // Destroy the proxy later, to keep it safe for other shutdown handlers:
- DestroyEvent *e = new DestroyEvent( QObjectProxy::DestroyProxy );
- QApplication::postEvent( proxy, e );
- }
- }
-
- QtCollider::unlockLang();
+ QWidgetList windows = QApplication::topLevelWidgets();
+ Q_FOREACH( QWidget *w, windows )
+ w->hide();
}
void LangClient::customEvent( QEvent *e )

0 comments on commit 500d3d5

Please sign in to comment.