Commit e2972af4 authored by Rob Shearman's avatar Rob Shearman Committed by Alexandre Julliard

msi: Rewrite the second loop in ACTION_FinishCustomActions so that it always terminates.

Create an array of handles to wait on so that we can wait without holding a critical section.
parent 95f38b75
......@@ -859,6 +859,9 @@ static UINT HANDLE_CustomType34(MSIPACKAGE *package, LPCWSTR source,
void ACTION_FinishCustomActions(MSIPACKAGE* package)
{
struct list *item;
HANDLE *wait_handles;
unsigned int handle_count, i;
msi_custom_action_info *info, *cursor;
while ((item = list_head( &package->RunningActions )))
{
......@@ -874,27 +877,25 @@ void ACTION_FinishCustomActions(MSIPACKAGE* package)
msi_free( action );
}
while (1)
{
HANDLE handle;
msi_custom_action_info *info;
EnterCriticalSection( &msi_custom_action_cs );
EnterCriticalSection( &msi_custom_action_cs );
item = list_head( &msi_pending_custom_actions );
info = LIST_ENTRY( item, msi_custom_action_info, entry );
handle_count = list_count( &msi_pending_custom_actions );
wait_handles = HeapAlloc( GetProcessHeap(), 0, handle_count * sizeof(HANDLE) );
if (item && info->package == package )
handle_count = 0;
LIST_FOR_EACH_ENTRY_SAFE( info, cursor, &msi_pending_custom_actions, msi_custom_action_info, entry )
{
if (info->package == package )
{
handle = info->handle;
wait_handles[handle_count++] = info->handle;
free_custom_action_data( info );
}
else
handle = NULL;
LeaveCriticalSection( &msi_custom_action_cs );
}
if (!item)
break;
LeaveCriticalSection( &msi_custom_action_cs );
msi_dialog_check_messages( handle );
}
for (i = 0; i < handle_count; i++)
msi_dialog_check_messages( wait_handles[i] );
HeapFree( GetProcessHeap(), 0, wait_handles );
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment