Hans Leidekker : msi: Don' t subscribe more than once to the same control event.
Alexandre Julliard
julliard at winehq.org
Thu Jun 23 04:10:10 CDT 2011
Module: wine
Branch: master
Commit: d1ae506e4084ba3f8ec923a61e91a4d6f9d9ddc3
URL: http://source.winehq.org/git/wine.git/?a=commit;h=d1ae506e4084ba3f8ec923a61e91a4d6f9d9ddc3
Author: Hans Leidekker <hans at codeweavers.com>
Date: Thu Jun 23 09:07:48 2011 +0200
msi: Don't subscribe more than once to the same control event.
---
dlls/msi/events.c | 24 ++++++++++++++++--------
1 files changed, 16 insertions(+), 8 deletions(-)
diff --git a/dlls/msi/events.c b/dlls/msi/events.c
index 88b84ff..3047d1d 100644
--- a/dlls/msi/events.c
+++ b/dlls/msi/events.c
@@ -254,9 +254,19 @@ VOID ControlEvent_SubscribeToEvent( MSIPACKAGE *package, msi_dialog *dialog,
{
struct subscriber *sub;
- sub = msi_alloc(sizeof (*sub));
- if( !sub )
- return;
+ TRACE("event %s control %s attribute %s\n", debugstr_w(event), debugstr_w(control), debugstr_w(attribute));
+
+ LIST_FOR_EACH_ENTRY( sub, &package->subscriptions, struct subscriber, entry )
+ {
+ if (!strcmpiW( sub->event, event ) &&
+ !strcmpiW( sub->control, control ) &&
+ !strcmpiW( sub->attribute, attribute ))
+ {
+ TRACE("already subscribed\n");
+ return;
+ };
+ }
+ if (!(sub = msi_alloc( sizeof(*sub) ))) return;
sub->dialog = dialog;
sub->event = strdupW(event);
sub->control = strdupW(control);
@@ -264,17 +274,15 @@ VOID ControlEvent_SubscribeToEvent( MSIPACKAGE *package, msi_dialog *dialog,
list_add_tail( &package->subscriptions, &sub->entry );
}
-VOID ControlEvent_FireSubscribedEvent( MSIPACKAGE *package, LPCWSTR event,
- MSIRECORD *rec )
+VOID ControlEvent_FireSubscribedEvent( MSIPACKAGE *package, LPCWSTR event, MSIRECORD *rec )
{
struct subscriber *sub;
- TRACE("Firing Event %s\n",debugstr_w(event));
+ TRACE("Firing event %s\n", debugstr_w(event));
LIST_FOR_EACH_ENTRY( sub, &package->subscriptions, struct subscriber, entry )
{
- if (strcmpiW( sub->event, event ))
- continue;
+ if (strcmpiW( sub->event, event )) continue;
msi_dialog_handle_event( sub->dialog, sub->control, sub->attribute, rec );
}
}
More information about the wine-cvs
mailing list