File tree Expand file tree Collapse file tree 1 file changed +6
-1
lines changed Expand file tree Collapse file tree 1 file changed +6
-1
lines changed Original file line number Diff line number Diff line change @@ -6371,6 +6371,10 @@ constructor TEngineClient.Create( AOwner : TComponent );
63716371
63726372destructor  TEngineClient.Destroy;
63736373begin 
6374+   //  if the client is destroyed before the Python Engine then
6375+   //  we need to finalize it.  Otherwise it will already be finalized
6376+   if  FInitialized then 
6377+     Finalize;
63746378  Engine := nil ; //  This detaches the client from the Engine.
63756379  if  Assigned( FOnDestroy ) then 
63766380    FOnDestroy( Self );
@@ -8647,7 +8651,8 @@ procedure TPythonType.Initialize;
86478651
86488652procedure  TPythonType.Finalize ;
86498653begin 
8650-   Engine.Py_CLEAR(FCreateFunc);
8654+   if  Assigned(Engine) then 
8655+     Engine.Py_CLEAR(FCreateFunc);
86518656  FCreateFunc := nil ;
86528657  inherited ;
86538658end ;
    
 
   
 
     
   
   
          
     
  
    
     
 
    
      
     
 
     
    You can’t perform that action at this time.
  
 
    
  
     
    
      
        
     
 
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments