File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -108,25 +108,24 @@ internal static void Shutdown()
108108 }
109109
110110 RestoreImport ( ) ;
111+
111112 bool shouldFreeDef = Runtime . Refcount ( py_clr_module ) == 1 ;
112- #if ! NETSTANDARD
113- if ( Runtime . ShutdownMode != ShutdownMode . Reload )
114- #endif
113+ Runtime . XDecref ( py_clr_module ) ;
114+ py_clr_module = IntPtr . Zero ;
115+ if ( shouldFreeDef )
115116 {
116- Runtime . XDecref ( py_clr_module ) ;
117- py_clr_module = IntPtr . Zero ;
118- if ( shouldFreeDef )
119- {
120- ReleaseModuleDef ( ) ;
121- }
122- Runtime . XDecref ( root . pyHandle ) ;
117+ ReleaseModuleDef ( ) ;
123118 }
119+
120+ Runtime . XDecref ( root . pyHandle ) ;
124121 root = null ;
125122 CLRModule . Reset ( ) ;
126123 }
127124
128125 internal static void SaveRuntimeData ( RuntimeDataStorage storage )
129126 {
127+ Runtime . XIncref ( py_clr_module ) ;
128+ Runtime . XIncref ( root . pyHandle ) ;
130129 storage . AddValue ( "py_clr_module" , py_clr_module ) ;
131130 storage . AddValue ( "root" , root . pyHandle ) ;
132131 }
You can’t perform that action at this time.
0 commit comments