File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -143,7 +143,13 @@ class CVTHook : public CMemory
143143public:
144144 using Function_t = R (*)(Args...); // Is the pointer‐to‐function type matching the signature of the virtual method.
145145
146- ~CVTHook () { Unhook (); }
146+ ~CVTHook ()
147+ {
148+ if (IsHooked ())
149+ {
150+ UnhookImpl ();
151+ }
152+ }
147153
148154 bool IsHooked () const noexcept { return IsValid (); } // Returns true if a hook is currently installed (i.e., we have a valid vtable slot pointer).
149155 void Clear () noexcept { SetPtr (nullptr ); m_pOriginalFn = nullptr ; }
@@ -251,10 +257,13 @@ class CVTFHook : public CVTHook<R, Args...>
251257 CBase::Hook (pVTable, nIndex, +[](Args... args) -> R { return sm_callback (args...); });
252258 }
253259
254- void Unhook ()
260+ bool Unhook ()
255261 {
256- CBase::Unhook ();
262+ bool bResult = CBase::Unhook ();
263+
257264 sm_callback = nullptr ;
265+
266+ return bResult;
258267 }
259268
260269protected:
You can’t perform that action at this time.
0 commit comments