alandtse / CommonLibVR

This is an experimental reverse engineered library for Skyrim VR (ported from CommonLibSSE). There are two main branches (VR) which is based on po3's using ifdefs, and NG which is an updated NG build.
MIT License
23 stars 21 forks source link

fix: add missing handler #38

Closed Nightfallstorm closed 8 months ago

Nightfallstorm commented 8 months ago

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.

alandtse commented 8 months ago

Is the deleteme only a VR fix?

Nightfallstorm commented 8 months ago

Yes it is, the WorldSpaceMenu only exists in VR