Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: add missing handler #38

Merged
merged 2 commits into from
Jan 22, 2024
Merged

fix: add missing handler #38

merged 2 commits into from
Jan 22, 2024

Conversation

Nightfallstorm
Copy link
Collaborator

@Nightfallstorm Nightfallstorm commented Jan 21, 2024

Additionally, added a fix for CTD when deleting a WorldSpaceMenu, such as in QuicklootVR. The menu's menuNode is already deleted when the pointer is reset if it has no ref counts, leading to code that calls DeleteThis twice:

// Decompiled C code from QuickLoot DLL
if ( v3 )
    {
      (v3->DetachChild2)(v3);
      this->menuNode._ptr->DeleteThis(this->menuNode._ptr);
      v4 = this->menuNode._ptr;
      if ( v4 )
      {
        if ( _InterlockedExchangeAdd(&v4->_refCount, 0xFFFFFFFF) == 1 )
          v4->DeleteThis(v4);
        this->menuNode._ptr = 0i64;
      }
    }

Removed the explicit DeleteThis call to fix this.

@Nightfallstorm Nightfallstorm added the bug Something isn't working label Jan 21, 2024
@Nightfallstorm Nightfallstorm self-assigned this Jan 21, 2024
`menuNode.reset()` already invokes `DeleteThis` when the pointer is reset if the ref count is 0. Removed the explicit `DeleteThis` call to prevent duplicate calls and prevent deleting the node if it is still used elsewhere
@alandtse
Copy link
Owner

Is the deleteme only a VR fix?

@Nightfallstorm
Copy link
Collaborator Author

Yes it is, the WorldSpaceMenu only exists in VR

@alandtse alandtse merged commit c905827 into alandtse:vr Jan 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants