NineUnknown_ctor( struct NineUnknown *This,
struct NineUnknownParams *pParams )
{
- This->refs = pParams->container ? 0 : 1;
- This->bind = 0;
- This->forward = !This->refs;
+ if (pParams->container) {
+ This->refs = 0;
+ This->forward = true;
+ This->bind = 0;
+ assert(!pParams->start_with_bind_not_ref);
+ } else if (pParams->start_with_bind_not_ref) {
+ This->refs = 0;
+ This->forward = false;
+ This->bind = 1;
+ } else {
+ This->refs = 1;
+ This->forward = false;
+ This->bind = 0;
+ }
+
This->container = pParams->container;
This->device = pParams->device;
if (This->refs && This->device)
void (*dtor)(void *data);
struct NineUnknown *container;
struct NineDevice9 *device;
+ bool start_with_bind_not_ref;
};
HRESULT
__params.dtor = (void *)Nine##nine##_dtor; \
__params.container = NULL; \
__params.device = dev; \
+ __params.start_with_bind_not_ref = false; \
{ \
HRESULT __hr = Nine##nine##_ctor(__data, &__params, ## __VA_ARGS__); \
if (FAILED(__hr)) { \
__params.dtor = (void *)Nine##nine##_dtor; \
__params.container = NULL; \
__params.device = NULL; \
+ __params.start_with_bind_not_ref = false; \
{ \
HRESULT __hr = Nine##nine##_ctor(__data, &__params, ## __VA_ARGS__); \
if (FAILED(__hr)) { \