1
- using System ;
1
+ using System ;
2
2
using System . Collections . Generic ;
3
3
using System . IO ;
4
4
using System . Linq ;
@@ -223,6 +223,15 @@ public static void Initialize(IEnumerable<string> args, bool setSysArgv = true)
223
223
224
224
// Make sure we clean up properly on app domain unload.
225
225
AppDomain . CurrentDomain . DomainUnload += OnDomainUnload ;
226
+ //////////////////dltrace/////////////////////
227
+ /* Exec(@"
228
+ import UnityEngine
229
+ import threading
230
+ UnityEngine.Debug.Log('>>>>>>>>> Done with PythonEngine.Initialized threading.current_thread() = %s'%threading.current_thread())
231
+ ");
232
+ */
233
+ //////////////////dltrace/////////////////////
234
+
226
235
}
227
236
}
228
237
@@ -302,6 +311,62 @@ public static void Shutdown()
302
311
{
303
312
if ( initialized )
304
313
{
314
+ //////////////////dltrace/////////////////////
315
+ /* Exec(@"
316
+ import UnityEngine
317
+ import threading
318
+ UnityEngine.Debug.Log('>>>>>>>>> In PythonEngine.Shutdown() threading.current_thread() = %s'%threading.current_thread())
319
+ ");
320
+ */
321
+ //////////////////dltrace/////////////////////
322
+
323
+ //////////////////dltrace/////////////////////
324
+ /* Exec(@"
325
+ import UnityEngine
326
+
327
+ import sgtk
328
+ UnityEngine.Debug.Log('>>>>>>>>> Destroying the engine')
329
+ sgtk.platform.current_engine().destroy()
330
+ UnityEngine.Debug.Log('>>>>>>>>> Engine destroyed')
331
+
332
+ from sgtk.platform.qt import QtGui
333
+ theApp = QtGui.QApplication.instance()
334
+
335
+ UnityEngine.Debug.Log('>>>>>>>>> processing events')
336
+ theApp.processEvents()
337
+
338
+ if theApp:
339
+ for child in theApp.children():
340
+ UnityEngine.Debug.Log('>>>>>>>>> Scheduling for deletion: %s'%child)
341
+ child.deleteLater()
342
+
343
+ UnityEngine.Debug.Log('>>>>>>>>> processing events')
344
+ theApp.processEvents()
345
+
346
+ UnityEngine.Debug.Log('>>>>>>>>> calling quit on QApplication')
347
+ retVal = theApp.quit()
348
+ UnityEngine.Debug.Log('>>>>>>>>> done. retVal = %s'%retVal)
349
+
350
+ UnityEngine.Debug.Log('>>>>>>>>> processing events')
351
+ theApp.processEvents()
352
+
353
+ #import sys
354
+ #UnityEngine.Debug.Log('>>>>>>>>> calling sys.exit()')
355
+ #sys.exit()
356
+ #UnityEngine.Debug.Log('>>>>>>>>> done calling sys.exit()')
357
+
358
+ ");
359
+ */
360
+ //////////////////dltrace/////////////////////
361
+
362
+ //////////////////dltrace/////////////////////
363
+ /* Exec(@"
364
+ import UnityEngine
365
+ UnityEngine.Debug.Log('>>>>>>>>> Back from python cleanup')
366
+ ");
367
+ */
368
+ //////////////////dltrace/////////////////////
369
+
305
370
PyScopeManager . Global . Clear ( ) ;
306
371
Marshal . FreeHGlobal ( _pythonHome ) ;
307
372
_pythonHome = IntPtr . Zero ;
@@ -312,6 +377,7 @@ public static void Shutdown()
312
377
313
378
Runtime . Shutdown ( ) ;
314
379
380
+
315
381
AppDomain . CurrentDomain . DomainUnload -= OnDomainUnload ;
316
382
initialized = false ;
317
383
}
0 commit comments