1.1 --- a/sourcehook/test/test3.cpp Sun Oct 07 03:12:19 2007 +0000
1.2 +++ b/sourcehook/test/test3.cpp Sun Oct 07 22:10:07 2007 +0000
1.3 @@ -47,8 +47,6 @@
1.4 }
1.5 };
1.6
1.7 - class DerivedDerived : public Derived { };
1.8 -
1.9 SH_DECL_HOOK0_void(Derived, Func1, SH_NOATTRIB, 0);
1.10 SH_DECL_HOOK0_void(Derived, Func2, SH_NOATTRIB, 0);
1.11 SH_DECL_HOOK0_void(Derived, Func3, SH_NOATTRIB, 0);
1.12 @@ -74,7 +72,7 @@
1.13 GET_SHPTR(g_SHPtr);
1.14 g_PLID = 1337;
1.15
1.16 - DerivedDerived inst;
1.17 + Derived inst;
1.18 Derived *pD = &inst;
1.19 Base1 *pB1 = pD;
1.20 Base2 *pB2 = pD;
1.21 @@ -87,10 +85,11 @@
1.22 // Get a callclass for pD
1.23 // Verify whether the this pointers are correct
1.24 // Also call them normally to make sure that we aren't messing it up ;)
1.25 + SourceHook::CallClass<Derived> *pD_CC = SH_GET_CALLCLASS(pD);
1.26
1.27 - SH_CALL(pD, &Derived::Func1)();
1.28 - SH_CALL(pD, &Derived::Func2)();
1.29 - SH_CALL(pD, &Derived::Func3)();
1.30 + SH_CALL(pD_CC, &Derived::Func1)();
1.31 + SH_CALL(pD_CC, &Derived::Func2)();
1.32 + SH_CALL(pD_CC, &Derived::Func3)();
1.33 pD->Func1();
1.34 pD->Func2();
1.35 pD->Func3();
1.36 @@ -104,8 +103,8 @@
1.37 new State_Func3_Called(pD),
1.38 NULL), "Part 1");
1.39
1.40 - SH_CALL(pD, &Base1::Func1)();
1.41 - SH_CALL(pD, &Base2::Func2)();
1.42 + SH_CALL(pD_CC, &Base1::Func1)();
1.43 + SH_CALL(pD_CC, &Base2::Func2)();
1.44
1.45 CHECK_STATES((&g_States,
1.46 new State_Func1_Called(pB1),
1.47 @@ -115,8 +114,11 @@
1.48 // 2)
1.49 // Get callclasses for the other ones and verify it as well
1.50
1.51 - SH_CALL(pB1, &Base1::Func1)();
1.52 - SH_CALL(pB2, &Base2::Func2)();
1.53 + SourceHook::CallClass<Base1> *pB1_CC = SH_GET_CALLCLASS(pB1);
1.54 + SourceHook::CallClass<Base2> *pB2_CC = SH_GET_CALLCLASS(pB2);
1.55 +
1.56 + SH_CALL(pB1_CC, &Base1::Func1)();
1.57 + SH_CALL(pB2_CC, &Base2::Func2)();
1.58
1.59 CHECK_STATES((&g_States,
1.60 new State_Func1_Called(pB1),
1.61 @@ -210,11 +212,11 @@
1.62 new State_Func3_Called(pD),
1.63 NULL), "Part 5.1");
1.64
1.65 - SH_CALL(pD, &Derived::Func1)();
1.66 - SH_CALL(pD, &Derived::Func2)();
1.67 - SH_CALL(pD, &Derived::Func3)();
1.68 - SH_CALL(pB1, &Base1::Func1)();
1.69 - SH_CALL(pB2, &Base2::Func2)();
1.70 + SH_CALL(pD_CC, &Derived::Func1)();
1.71 + SH_CALL(pD_CC, &Derived::Func2)();
1.72 + SH_CALL(pD_CC, &Derived::Func3)();
1.73 + SH_CALL(pB1_CC, &Base1::Func1)();
1.74 + SH_CALL(pB2_CC, &Base2::Func2)();
1.75
1.76 CHECK_STATES((&g_States,
1.77 new State_Func1_Called(pB1),
1.78 @@ -228,5 +230,9 @@
1.79 SH_REMOVE_HOOK(Derived, Func2, pD, SH_STATIC(Handler_Func2), false);
1.80 SH_REMOVE_HOOK(Derived, Func3, pD, SH_STATIC(Handler_Func3), false);
1.81
1.82 + SH_RELEASE_CALLCLASS(pB1_CC);
1.83 + SH_RELEASE_CALLCLASS(pB2_CC);
1.84 + SH_RELEASE_CALLCLASS(pD_CC);
1.85 +
1.86 return true;
1.87 }