msi: Provide a specific dialog to ControlEvent_SubscribeToEvent, as package->dialog does not always point to the same dialog.

This commit is contained in:
James Hawkins 2006-10-03 15:01:23 -07:00 committed by Alexandre Julliard
parent 7ee3a4efdf
commit 2a8c38ff74
3 changed files with 8 additions and 9 deletions

View File

@ -295,8 +295,8 @@ extern UINT msi_create_component_directories( MSIPACKAGE *package );
extern VOID ControlEvent_FireSubscribedEvent(MSIPACKAGE *package, LPCWSTR event, extern VOID ControlEvent_FireSubscribedEvent(MSIPACKAGE *package, LPCWSTR event,
MSIRECORD *data); MSIRECORD *data);
extern VOID ControlEvent_CleanupSubscriptions(MSIPACKAGE *package); extern VOID ControlEvent_CleanupSubscriptions(MSIPACKAGE *package);
extern VOID ControlEvent_SubscribeToEvent(MSIPACKAGE *package, LPCWSTR event, extern VOID ControlEvent_SubscribeToEvent(MSIPACKAGE *package, msi_dialog *dialog,
LPCWSTR control, LPCWSTR attribute); LPCWSTR event, LPCWSTR control, LPCWSTR attribute);
extern VOID ControlEvent_UnSubscribeToEvent( MSIPACKAGE *package, LPCWSTR event, extern VOID ControlEvent_UnSubscribeToEvent( MSIPACKAGE *package, LPCWSTR event,
LPCWSTR control, LPCWSTR attribute ); LPCWSTR control, LPCWSTR attribute );

View File

@ -602,7 +602,7 @@ static void msi_dialog_map_events(msi_dialog* dialog, LPCWSTR control)
event = MSI_RecordGetString( row, 3 ); event = MSI_RecordGetString( row, 3 );
attribute = MSI_RecordGetString( row, 4 ); attribute = MSI_RecordGetString( row, 4 );
ControlEvent_SubscribeToEvent( dialog->package, event, control, attribute ); ControlEvent_SubscribeToEvent( dialog->package, dialog, event, control, attribute );
msiobj_release( &row->hdr ); msiobj_release( &row->hdr );
} }

View File

@ -48,6 +48,7 @@ struct _events {
struct subscriber { struct subscriber {
struct list entry; struct list entry;
msi_dialog *dialog;
LPWSTR event; LPWSTR event;
LPWSTR control; LPWSTR control;
LPWSTR attribute; LPWSTR attribute;
@ -267,14 +268,15 @@ static void free_subscriber( struct subscriber *sub )
msi_free(sub); msi_free(sub);
} }
VOID ControlEvent_SubscribeToEvent( MSIPACKAGE *package, LPCWSTR event, VOID ControlEvent_SubscribeToEvent( MSIPACKAGE *package, msi_dialog *dialog,
LPCWSTR control, LPCWSTR attribute ) LPCWSTR event, LPCWSTR control, LPCWSTR attribute )
{ {
struct subscriber *sub; struct subscriber *sub;
sub = msi_alloc(sizeof (*sub)); sub = msi_alloc(sizeof (*sub));
if( !sub ) if( !sub )
return; return;
sub->dialog = dialog;
sub->event = strdupW(event); sub->event = strdupW(event);
sub->control = strdupW(control); sub->control = strdupW(control);
sub->attribute = strdupW(attribute); sub->attribute = strdupW(attribute);
@ -309,14 +311,11 @@ VOID ControlEvent_FireSubscribedEvent( MSIPACKAGE *package, LPCWSTR event,
TRACE("Firing Event %s\n",debugstr_w(event)); TRACE("Firing Event %s\n",debugstr_w(event));
if (!package->dialog)
return;
LIST_FOR_EACH_ENTRY( sub, &package->subscriptions, struct subscriber, entry ) LIST_FOR_EACH_ENTRY( sub, &package->subscriptions, struct subscriber, entry )
{ {
if (lstrcmpiW(sub->event, event)) if (lstrcmpiW(sub->event, event))
continue; continue;
msi_dialog_handle_event( package->dialog, sub->control, msi_dialog_handle_event( sub->dialog, sub->control,
sub->attribute, rec ); sub->attribute, rec );
} }
} }