Skip to content

Commit

Permalink
.NET: Move list creation into write lock
Browse files Browse the repository at this point in the history
  • Loading branch information
praydog committed Sep 17, 2024
1 parent fe3b0d5 commit 8136d48
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions csharp-api/REFrameworkNET/TypeDefinition.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -302,15 +302,16 @@ namespace REFrameworkNET {

System::Collections::Generic::List<REFrameworkNET::ManagedObject^>^ TypeDefinition::GetRuntimeMethods() {
if (m_runtimeMethods == nullptr) {
m_runtimeMethods = gcnew System::Collections::Generic::List<ManagedObject^>();
auto runtimeType = GetRuntimeType();

m_lock->EnterWriteLock();

m_runtimeMethods = gcnew System::Collections::Generic::List<ManagedObject^>();

try {
if (runtimeType != nullptr) {
auto methods = (REFrameworkNET::ManagedObject^)runtimeType->Call("GetMethods(System.Reflection.BindingFlags)", System::Reflection::BindingFlags::Public | System::Reflection::BindingFlags::NonPublic | System::Reflection::BindingFlags::Instance | System::Reflection::BindingFlags::Static);

if (methods != nullptr) {
for each (REFrameworkNET::ManagedObject^ method in methods) {
if (method == nullptr) {
Expand Down

0 comments on commit 8136d48

Please sign in to comment.