| 39 | void *cbo = 0; |
| 40 | asITypeInfo *cbot = 0; |
| 41 | void SetCB(asIScriptGeneric *gen) |
| 42 | { |
| 43 | if( cb ) |
| 44 | cb->Release(); |
| 45 | if( cbo ) |
| 46 | { |
| 47 | gen->GetEngine()->ReleaseScriptObject(cbo, cbot); |
| 48 | cbo = cbot = 0; |
| 49 | } |
| 50 | asIScriptFunction *f = (asIScriptFunction*)gen->GetArgAddress(0); |
| 51 | |
| 52 | // For 2.32.2 and earlier, the generic calling convention automatically released all |
| 53 | // handles received, so to compensate for that it would be necessary to add a ref if |
| 54 | // the handle should be kept |
| 55 | if( gen->GetEngine()->GetEngineProperty(asEP_GENERIC_CALL_MODE) == 0 ) |
| 56 | f->AddRef(); |
| 57 | |
| 58 | if( f && f->GetFuncType() == asFUNC_DELEGATE ) |
| 59 | { |
| 60 | cbo = f->GetDelegateObject(); |
| 61 | cbot = f->GetDelegateObjectType(); |
| 62 | cb = f->GetDelegateFunction(); |
| 63 | |
| 64 | // Hold on to the objects |
| 65 | gen->GetEngine()->AddRefScriptObject(cbo, cbot); |
| 66 | cb->AddRef(); |
| 67 | |
| 68 | // Release the delegate, which we don't need |
| 69 | f->Release(); |
| 70 | } |
| 71 | else |
| 72 | { |
| 73 | cb = f; |
| 74 | } |
| 75 | } |
| 76 | |
| 77 | bool Test() |
| 78 | { |
nothing calls this directly
no test coverage detected