You've already forked UnrealEngineUWP
mirror of
https://github.com/izzy2lost/UnrealEngineUWP.git
synced 2026-03-26 18:15:20 -07:00
Fixed Python GIL (Global Interpreter Lock) deadlock while loading an asset.
- Released the GIL in Finalize() - rename class, get default object and refresh BlueprintActionDatabase #jira FORT-444807 - Python Load_Asset is causing the editor to hang if it has to load certain assets #rb Jamie.Dale, Patrick.Laflamme #ushell-cherrypick of 19292501 by Max.Chen #preflight 6226843d1938e4deaa7916fc [CL 19293291 by Patrick Laflamme in ue5-main branch]
This commit is contained in:
@@ -1271,12 +1271,15 @@ public:
|
||||
{
|
||||
PrepareOldClassForReinstancing();
|
||||
}
|
||||
|
||||
Py_BEGIN_ALLOW_THREADS
|
||||
NewClass->Rename(*ClassName, nullptr, REN_DontCreateRedirectors);
|
||||
|
||||
// Finalize the class
|
||||
NewClass->Bind();
|
||||
NewClass->StaticLink(true);
|
||||
NewClass->AssembleReferenceTokenStream();
|
||||
Py_END_ALLOW_THREADS
|
||||
|
||||
// Add the object meta-data to the type
|
||||
NewClass->PyMetaData.Class = NewClass;
|
||||
@@ -1287,7 +1290,9 @@ public:
|
||||
FPyWrapperTypeRegistry::Get().RegisterWrappedClassType(NewClass->GetFName() , PyType);
|
||||
|
||||
// Ensure the CDO exists
|
||||
Py_BEGIN_ALLOW_THREADS
|
||||
NewClass->GetDefaultObject();
|
||||
Py_END_ALLOW_THREADS
|
||||
|
||||
// Re-instance the old class and re-parent any derived classes to this new type
|
||||
if (OldClass)
|
||||
@@ -1298,6 +1303,7 @@ public:
|
||||
|
||||
if (FBlueprintActionDatabase* ActionDB = FBlueprintActionDatabase::TryGet())
|
||||
{
|
||||
Py_BEGIN_ALLOW_THREADS
|
||||
// Notify Blueprints that there is a new class to add to the action list
|
||||
ActionDB->RefreshClassActions(NewClass);
|
||||
|
||||
@@ -1305,6 +1311,7 @@ public:
|
||||
{
|
||||
ActionDB->RefreshClassActions(OldClass);
|
||||
}
|
||||
Py_END_ALLOW_THREADS
|
||||
}
|
||||
|
||||
// Null the NewClass pointer so the destructor doesn't kill it
|
||||
|
||||
Reference in New Issue
Block a user