mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
avoid core dump with WIN32OLE_EVENT. [ruby-dev:27133]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@9223 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
524ad518b6
commit
f8c300e063
2 changed files with 16 additions and 3 deletions
|
@ -1,3 +1,8 @@
|
||||||
|
Mon Sep 19 13:44:03 2005 Masaki Suketa <masaki.suketa@nifty.ne.jp>
|
||||||
|
|
||||||
|
* ext/win32ole/win32ole.c: avoid core dump with WIN32OLE_EVENT.
|
||||||
|
[ruby-dev:27133]
|
||||||
|
|
||||||
Mon Sep 19 10:36:06 2005 Minero Aoki <aamine@loveruby.net>
|
Mon Sep 19 10:36:06 2005 Minero Aoki <aamine@loveruby.net>
|
||||||
|
|
||||||
* lib/fileutils.rb (cp_r): default is :dereference_root=>true for
|
* lib/fileutils.rb (cp_r): default is :dereference_root=>true for
|
||||||
|
|
|
@ -78,7 +78,7 @@
|
||||||
|
|
||||||
#define WC2VSTR(x) ole_wc2vstr((x), TRUE)
|
#define WC2VSTR(x) ole_wc2vstr((x), TRUE)
|
||||||
|
|
||||||
#define WIN32OLE_VERSION "0.6.4"
|
#define WIN32OLE_VERSION "0.6.5"
|
||||||
|
|
||||||
typedef HRESULT (STDAPICALLTYPE FNCOCREATEINSTANCEEX)
|
typedef HRESULT (STDAPICALLTYPE FNCOCREATEINSTANCEEX)
|
||||||
(REFCLSID, IUnknown*, DWORD, COSERVERINFO*, DWORD, MULTI_QI*);
|
(REFCLSID, IUnknown*, DWORD, COSERVERINFO*, DWORD, MULTI_QI*);
|
||||||
|
@ -134,6 +134,7 @@ typedef struct tagIEVENTSINKOBJ {
|
||||||
DWORD m_dwCookie;
|
DWORD m_dwCookie;
|
||||||
IConnectionPoint *pConnectionPoint;
|
IConnectionPoint *pConnectionPoint;
|
||||||
ITypeInfo *pTypeInfo;
|
ITypeInfo *pTypeInfo;
|
||||||
|
int *ptr_freed;
|
||||||
}IEVENTSINKOBJ, *PIEVENTSINKOBJ;
|
}IEVENTSINKOBJ, *PIEVENTSINKOBJ;
|
||||||
|
|
||||||
VALUE cWIN32OLE;
|
VALUE cWIN32OLE;
|
||||||
|
@ -183,6 +184,7 @@ struct oleparamdata {
|
||||||
|
|
||||||
struct oleeventdata {
|
struct oleeventdata {
|
||||||
IEVENTSINKOBJ *pEvent;
|
IEVENTSINKOBJ *pEvent;
|
||||||
|
int freed;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct oleparam {
|
struct oleparam {
|
||||||
|
@ -5095,6 +5097,7 @@ EVENTSINK_Constructor() {
|
||||||
pEv->m_dwCookie = 0;
|
pEv->m_dwCookie = 0;
|
||||||
pEv->pConnectionPoint = NULL;
|
pEv->pConnectionPoint = NULL;
|
||||||
pEv->pTypeInfo = NULL;
|
pEv->pTypeInfo = NULL;
|
||||||
|
pEv->ptr_freed = NULL;
|
||||||
return pEv;
|
return pEv;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5102,6 +5105,7 @@ void EVENTSINK_Destructor(
|
||||||
PIEVENTSINKOBJ pEVObj
|
PIEVENTSINKOBJ pEVObj
|
||||||
) {
|
) {
|
||||||
if(pEVObj != NULL) {
|
if(pEVObj != NULL) {
|
||||||
|
*(pEVObj->ptr_freed) = 1;
|
||||||
free(pEVObj);
|
free(pEVObj);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -5323,6 +5327,9 @@ ole_event_free(poleev)
|
||||||
ITypeInfo *pti = NULL;
|
ITypeInfo *pti = NULL;
|
||||||
IConnectionPoint *pcp = NULL;
|
IConnectionPoint *pcp = NULL;
|
||||||
|
|
||||||
|
if (poleev->freed == 1) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
if(poleev->pEvent) {
|
if(poleev->pEvent) {
|
||||||
pti = poleev->pEvent->pTypeInfo;
|
pti = poleev->pEvent->pTypeInfo;
|
||||||
if(pti) OLE_RELEASE(pti);
|
if(pti) OLE_RELEASE(pti);
|
||||||
|
@ -5362,7 +5369,7 @@ fev_initialize(argc, argv, self)
|
||||||
IConnectionPointContainer *pContainer;
|
IConnectionPointContainer *pContainer;
|
||||||
IConnectionPoint *pConnectionPoint;
|
IConnectionPoint *pConnectionPoint;
|
||||||
IEVENTSINKOBJ *pIEV;
|
IEVENTSINKOBJ *pIEV;
|
||||||
DWORD dwCookie;
|
DWORD dwCookie = 0;
|
||||||
struct oleeventdata *poleev;
|
struct oleeventdata *poleev;
|
||||||
|
|
||||||
rb_secure(4);
|
rb_secure(4);
|
||||||
|
@ -5423,7 +5430,8 @@ fev_initialize(argc, argv, self)
|
||||||
poleev->pEvent->pConnectionPoint = pConnectionPoint;
|
poleev->pEvent->pConnectionPoint = pConnectionPoint;
|
||||||
poleev->pEvent->pTypeInfo = pTypeInfo;
|
poleev->pEvent->pTypeInfo = pTypeInfo;
|
||||||
poleev->pEvent->m_dwCookie = dwCookie;
|
poleev->pEvent->m_dwCookie = dwCookie;
|
||||||
|
poleev->freed = 0;
|
||||||
|
poleev->pEvent->ptr_freed = &(poleev->freed);
|
||||||
rb_ary_push(ary_ole_event, self);
|
rb_ary_push(ary_ole_event, self);
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue