116
116
117
117
#define WC2VSTR (x ) ole_wc2vstr((x), TRUE)
118
118
119
- #define WIN32OLE_VERSION "1.0.7 "
119
+ #define WIN32OLE_VERSION "1.0.8 "
120
120
121
121
typedef HRESULT (STDAPICALLTYPE FNCOCREATEINSTANCEEX )
122
122
(REFCLSID , IUnknown * , DWORD , COSERVERINFO * , DWORD , MULTI_QI * );
@@ -170,8 +170,6 @@ typedef struct tagIEVENTSINKOBJ {
170
170
DWORD m_cRef ;
171
171
IID m_iid ;
172
172
int m_event_id ;
173
- DWORD m_dwCookie ;
174
- IConnectionPoint * pConnectionPoint ;
175
173
ITypeInfo * pTypeInfo ;
176
174
}IEVENTSINKOBJ , * PIEVENTSINKOBJ ;
177
175
@@ -229,7 +227,8 @@ struct oleparamdata {
229
227
};
230
228
231
229
struct oleeventdata {
232
- int freed ;
230
+ DWORD dwCookie ;
231
+ IConnectionPoint * pConnectionPoint ;
233
232
};
234
233
235
234
struct oleparam {
@@ -488,6 +487,7 @@ static HRESULT find_iid(VALUE ole, char *pitf, IID *piid, ITypeInfo **ppTypeInfo
488
487
static HRESULT find_default_source (VALUE ole , IID * piid , ITypeInfo * * ppTypeInfo );
489
488
static void ole_event_free (struct oleeventdata * poleev );
490
489
static VALUE fev_s_allocate (VALUE klass );
490
+ static VALUE ev_advise (int argc , VALUE * argv , VALUE self );
491
491
static VALUE fev_initialize (int argc , VALUE * argv , VALUE self );
492
492
static VALUE fev_s_msg_loop (VALUE klass );
493
493
static void add_event_call_back (VALUE obj , VALUE event , VALUE data );
@@ -7138,8 +7138,6 @@ EVENTSINK_Constructor() {
7138
7138
pEv -> lpVtbl = & vtEventSink ;
7139
7139
pEv -> m_cRef = 0 ;
7140
7140
pEv -> m_event_id = 0 ;
7141
- pEv -> m_dwCookie = 0 ;
7142
- pEv -> pConnectionPoint = NULL ;
7143
7141
pEv -> pTypeInfo = NULL ;
7144
7142
return pEv ;
7145
7143
}
@@ -7148,6 +7146,7 @@ void EVENTSINK_Destructor(
7148
7146
PIEVENTSINKOBJ pEVObj
7149
7147
) {
7150
7148
if (pEVObj != NULL ) {
7149
+ OLE_RELEASE (pEVObj -> pTypeInfo );
7151
7150
free (pEVObj );
7152
7151
pEVObj = NULL ;
7153
7152
}
@@ -7359,8 +7358,7 @@ find_default_source(VALUE ole, IID *piid, ITypeInfo **ppTypeInfo)
7359
7358
static void
7360
7359
ole_event_free (struct oleeventdata * poleev )
7361
7360
{
7362
- ITypeInfo * pti = NULL ;
7363
- IConnectionPoint * pcp = NULL ;
7361
+ OLE_FREE (poleev -> pConnectionPoint );
7364
7362
free (poleev );
7365
7363
}
7366
7364
@@ -7370,25 +7368,15 @@ fev_s_allocate(VALUE klass)
7370
7368
VALUE obj ;
7371
7369
struct oleeventdata * poleev ;
7372
7370
obj = Data_Make_Struct (klass ,struct oleeventdata ,0 ,ole_event_free ,poleev );
7373
- /*
7374
- poleev->pEvent = NULL;
7375
- */
7371
+ poleev -> dwCookie = 0 ;
7372
+ poleev -> pConnectionPoint = NULL ;
7376
7373
return obj ;
7377
7374
}
7378
7375
7379
- /*
7380
- * call-seq:
7381
- * WIN32OLE_EVENT.new(ole, event) #=> WIN32OLE_EVENT object.
7382
- *
7383
- * Returns OLE event object.
7384
- * The first argument specifies WIN32OLE object.
7385
- * The second argument specifies OLE event name.
7386
- * ie = WIN32OLE.new('InternetExplorer.Application')
7387
- * ev = WIN32OLE_EVENT.new(ie, 'DWebBrowserEvents')
7388
- */
7389
7376
static VALUE
7390
- fev_initialize (int argc , VALUE * argv , VALUE self )
7377
+ ev_advise (int argc , VALUE * argv , VALUE self )
7391
7378
{
7379
+
7392
7380
VALUE ole , itf ;
7393
7381
struct oledata * pole ;
7394
7382
char * pitf ;
@@ -7457,14 +7445,29 @@ fev_initialize(int argc, VALUE *argv, VALUE self)
7457
7445
Data_Get_Struct (self , struct oleeventdata , poleev );
7458
7446
pIEV -> m_event_id
7459
7447
= NUM2INT (rb_funcall (ary_ole_event , rb_intern ("length" ), 0 ));
7460
- pIEV -> pConnectionPoint = pConnectionPoint ;
7461
7448
pIEV -> pTypeInfo = pTypeInfo ;
7462
- pIEV -> m_dwCookie = dwCookie ;
7449
+ poleev -> dwCookie = dwCookie ;
7450
+ poleev -> pConnectionPoint = pConnectionPoint ;
7463
7451
7464
- rb_ary_push (ary_ole_event , self );
7452
+ return self ;
7453
+ }
7465
7454
7466
- events = rb_ary_new ();
7467
- rb_ivar_set (self , id_events , events );
7455
+ /*
7456
+ * call-seq:
7457
+ * WIN32OLE_EVENT.new(ole, event) #=> WIN32OLE_EVENT object.
7458
+ *
7459
+ * Returns OLE event object.
7460
+ * The first argument specifies WIN32OLE object.
7461
+ * The second argument specifies OLE event name.
7462
+ * ie = WIN32OLE.new('InternetExplorer.Application')
7463
+ * ev = WIN32OLE_EVENT.new(ie, 'DWebBrowserEvents')
7464
+ */
7465
+ static VALUE
7466
+ fev_initialize (int argc , VALUE * argv , VALUE self )
7467
+ {
7468
+ ev_advise (argc , argv , self );
7469
+ rb_ary_push (ary_ole_event , self );
7470
+ rb_ivar_set (self , id_events , rb_ary_new ());
7468
7471
return self ;
7469
7472
}
7470
7473
0 commit comments