Fix refcounting, use Interlocked functions.
This commit is contained in:
parent
21842318e9
commit
b3a7f37aaf
|
@ -157,7 +157,7 @@ void msiobj_addref( MSIOBJECTHDR *info )
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
info->refcount++;
|
InterlockedIncrement(&info->refcount);
|
||||||
}
|
}
|
||||||
|
|
||||||
void msiobj_lock( MSIOBJECTHDR *info )
|
void msiobj_lock( MSIOBJECTHDR *info )
|
||||||
|
@ -185,12 +185,12 @@ int msiobj_release( MSIOBJECTHDR *info )
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = info->refcount--;
|
ret = InterlockedDecrement( &info->refcount );
|
||||||
if (info->refcount == 0)
|
if( ret==0 )
|
||||||
{
|
{
|
||||||
if( info->destructor )
|
if( info->destructor )
|
||||||
info->destructor( info );
|
info->destructor( info );
|
||||||
HeapFree( GetProcessHeap(), 0, info );
|
HeapFree( GetProcessHeap(), 0, info );
|
||||||
TRACE("object %p destroyed\n", info);
|
TRACE("object %p destroyed\n", info);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -228,9 +228,12 @@ BOOL encode_base85_guid( GUID *guid, LPWSTR str )
|
||||||
VOID MSI_CloseDatabase( MSIOBJECTHDR *arg )
|
VOID MSI_CloseDatabase( MSIOBJECTHDR *arg )
|
||||||
{
|
{
|
||||||
MSIDATABASE *db = (MSIDATABASE *) arg;
|
MSIDATABASE *db = (MSIDATABASE *) arg;
|
||||||
|
DWORD r;
|
||||||
|
|
||||||
free_cached_tables( db );
|
free_cached_tables( db );
|
||||||
IStorage_Release( db->storage );
|
r = IStorage_Release( db->storage );
|
||||||
|
if( r )
|
||||||
|
ERR("database reference count was not zero (%ld)\n", r);
|
||||||
}
|
}
|
||||||
|
|
||||||
UINT MSI_OpenDatabaseW(LPCWSTR szDBPath, LPCWSTR szPersist, MSIDATABASE **pdb)
|
UINT MSI_OpenDatabaseW(LPCWSTR szDBPath, LPCWSTR szPersist, MSIDATABASE **pdb)
|
||||||
|
|
|
@ -53,7 +53,7 @@ struct tagMSIOBJECTHDR
|
||||||
{
|
{
|
||||||
UINT magic;
|
UINT magic;
|
||||||
UINT type;
|
UINT type;
|
||||||
UINT refcount;
|
DWORD refcount;
|
||||||
msihandledestructor destructor;
|
msihandledestructor destructor;
|
||||||
struct tagMSIOBJECTHDR *next;
|
struct tagMSIOBJECTHDR *next;
|
||||||
struct tagMSIOBJECTHDR *prev;
|
struct tagMSIOBJECTHDR *prev;
|
||||||
|
|
|
@ -461,6 +461,8 @@ UINT WINAPI MsiDatabaseCommit( MSIHANDLE hdb )
|
||||||
|
|
||||||
/* FIXME: unlock the database */
|
/* FIXME: unlock the database */
|
||||||
|
|
||||||
|
msiobj_release( &db->hdr );
|
||||||
|
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue