msi: Don't refcount the msi_custom_action_info struct.
This is unnecessary, and may have always been so. The struct will either be freed after it completes synchronously, or after it has completed asynchronously in ACTION_FinishCustomActions(). Signed-off-by: Zebediah Figura <z.figura12@gmail.com> Signed-off-by: Hans Leidekker <hans@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
583edf7f59
commit
b7f06accb0
|
@ -380,7 +380,6 @@ static UINT wait_process_handle(MSIPACKAGE* package, UINT type,
|
||||||
|
|
||||||
typedef struct _msi_custom_action_info {
|
typedef struct _msi_custom_action_info {
|
||||||
struct list entry;
|
struct list entry;
|
||||||
LONG refs;
|
|
||||||
MSIPACKAGE *package;
|
MSIPACKAGE *package;
|
||||||
LPWSTR source;
|
LPWSTR source;
|
||||||
LPWSTR target;
|
LPWSTR target;
|
||||||
|
@ -391,31 +390,22 @@ typedef struct _msi_custom_action_info {
|
||||||
DWORD arch;
|
DWORD arch;
|
||||||
} msi_custom_action_info;
|
} msi_custom_action_info;
|
||||||
|
|
||||||
static void release_custom_action_data( msi_custom_action_info *info )
|
static void free_custom_action_data( msi_custom_action_info *info )
|
||||||
{
|
{
|
||||||
EnterCriticalSection( &msi_custom_action_cs );
|
EnterCriticalSection( &msi_custom_action_cs );
|
||||||
|
|
||||||
if (!--info->refs)
|
list_remove( &info->entry );
|
||||||
{
|
if (info->handle)
|
||||||
list_remove( &info->entry );
|
CloseHandle( info->handle );
|
||||||
if (info->handle)
|
msi_free( info->action );
|
||||||
CloseHandle( info->handle );
|
msi_free( info->source );
|
||||||
msi_free( info->action );
|
msi_free( info->target );
|
||||||
msi_free( info->source );
|
msiobj_release( &info->package->hdr );
|
||||||
msi_free( info->target );
|
msi_free( info );
|
||||||
msiobj_release( &info->package->hdr );
|
|
||||||
msi_free( info );
|
|
||||||
}
|
|
||||||
|
|
||||||
LeaveCriticalSection( &msi_custom_action_cs );
|
LeaveCriticalSection( &msi_custom_action_cs );
|
||||||
}
|
}
|
||||||
|
|
||||||
/* must be called inside msi_custom_action_cs if info is in the pending custom actions list */
|
|
||||||
static void addref_custom_action_data( msi_custom_action_info *info )
|
|
||||||
{
|
|
||||||
info->refs++;
|
|
||||||
}
|
|
||||||
|
|
||||||
static UINT wait_thread_handle( msi_custom_action_info *info )
|
static UINT wait_thread_handle( msi_custom_action_info *info )
|
||||||
{
|
{
|
||||||
UINT rc = ERROR_SUCCESS;
|
UINT rc = ERROR_SUCCESS;
|
||||||
|
@ -429,7 +419,7 @@ static UINT wait_thread_handle( msi_custom_action_info *info )
|
||||||
if (!(info->type & msidbCustomActionTypeContinue))
|
if (!(info->type & msidbCustomActionTypeContinue))
|
||||||
rc = custom_get_thread_return( info->package, info->handle );
|
rc = custom_get_thread_return( info->package, info->handle );
|
||||||
|
|
||||||
release_custom_action_data( info );
|
free_custom_action_data( info );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -450,7 +440,6 @@ static msi_custom_action_info *find_action_by_guid( const GUID *guid )
|
||||||
{
|
{
|
||||||
if (IsEqualGUID( &info->guid, guid ))
|
if (IsEqualGUID( &info->guid, guid ))
|
||||||
{
|
{
|
||||||
addref_custom_action_data( info );
|
|
||||||
found = TRUE;
|
found = TRUE;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -725,7 +714,6 @@ static msi_custom_action_info *do_msidbCustomActionTypeDll(
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
msiobj_addref( &package->hdr );
|
msiobj_addref( &package->hdr );
|
||||||
info->refs = 2; /* 1 for our caller and 1 for thread we created */
|
|
||||||
info->package = package;
|
info->package = package;
|
||||||
info->type = type;
|
info->type = type;
|
||||||
info->target = strdupW( target );
|
info->target = strdupW( target );
|
||||||
|
@ -767,9 +755,7 @@ static msi_custom_action_info *do_msidbCustomActionTypeDll(
|
||||||
info->handle = CreateThread(NULL, 0, custom_client_thread, info, 0, NULL);
|
info->handle = CreateThread(NULL, 0, custom_client_thread, info, 0, NULL);
|
||||||
if (!info->handle)
|
if (!info->handle)
|
||||||
{
|
{
|
||||||
/* release both references */
|
free_custom_action_data( info );
|
||||||
release_custom_action_data( info );
|
|
||||||
release_custom_action_data( info );
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1056,7 +1042,6 @@ static DWORD ACTION_CallScript( const GUID *guid )
|
||||||
else
|
else
|
||||||
ERR("failed to create handle for %p\n", info->package );
|
ERR("failed to create handle for %p\n", info->package );
|
||||||
|
|
||||||
release_custom_action_data( info );
|
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1085,7 +1070,6 @@ static msi_custom_action_info *do_msidbCustomActionTypeScript(
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
msiobj_addref( &package->hdr );
|
msiobj_addref( &package->hdr );
|
||||||
info->refs = 2; /* 1 for our caller and 1 for thread we created */
|
|
||||||
info->package = package;
|
info->package = package;
|
||||||
info->type = type;
|
info->type = type;
|
||||||
info->target = strdupW( function );
|
info->target = strdupW( function );
|
||||||
|
@ -1100,9 +1084,7 @@ static msi_custom_action_info *do_msidbCustomActionTypeScript(
|
||||||
info->handle = CreateThread( NULL, 0, ScriptThread, &info->guid, 0, NULL );
|
info->handle = CreateThread( NULL, 0, ScriptThread, &info->guid, 0, NULL );
|
||||||
if (!info->handle)
|
if (!info->handle)
|
||||||
{
|
{
|
||||||
/* release both references */
|
free_custom_action_data( info );
|
||||||
release_custom_action_data( info );
|
|
||||||
release_custom_action_data( info );
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1496,7 +1478,8 @@ void ACTION_FinishCustomActions(const MSIPACKAGE* package)
|
||||||
EnterCriticalSection( &msi_custom_action_cs );
|
EnterCriticalSection( &msi_custom_action_cs );
|
||||||
LIST_FOR_EACH_ENTRY_SAFE( info, cursor, &msi_pending_custom_actions, msi_custom_action_info, entry )
|
LIST_FOR_EACH_ENTRY_SAFE( info, cursor, &msi_pending_custom_actions, msi_custom_action_info, entry )
|
||||||
{
|
{
|
||||||
if (info->package == package) release_custom_action_data( info );
|
if (info->package == package)
|
||||||
|
free_custom_action_data( info );
|
||||||
}
|
}
|
||||||
LeaveCriticalSection( &msi_custom_action_cs );
|
LeaveCriticalSection( &msi_custom_action_cs );
|
||||||
}
|
}
|
||||||
|
@ -1514,6 +1497,5 @@ UINT __cdecl s_remote_GetActionInfo(const GUID *guid, int *type, LPWSTR *dll, LP
|
||||||
*dll = strdupW(info->source);
|
*dll = strdupW(info->source);
|
||||||
*func = strdupWtoA(info->target);
|
*func = strdupWtoA(info->target);
|
||||||
|
|
||||||
release_custom_action_data(info);
|
|
||||||
return ERROR_SUCCESS;
|
return ERROR_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue