Module: wine
Branch: master
Commit: bb1276425f8ee475e9057ac8ab7513bf9c03f48c
URL: http://source.winehq.org/git/?p=wine.git;a=commit;h=bb1276425f8ee475e9057ac…
Author: Robert Shearman <rob(a)codeweavers.com>
Date: Thu Aug 31 17:21:13 2006 +0100
ole32: Allocate memory for a copy of the ptd member of FORMATETC in
DataAdviseHolder_Advise since there is no requirement for the
application to keep this memory valid for the lifetime of the
connection.
---
dlls/ole32/oleobj.c | 12 +++++++++++-
1 files changed, 11 insertions(+), 1 deletions(-)
diff --git a/dlls/ole32/oleobj.c b/dlls/ole32/oleobj.c
index ae06f18..a7470e4 100644
--- a/dlls/ole32/oleobj.c
+++ b/dlls/ole32/oleobj.c
@@ -723,8 +723,18 @@ static HRESULT WINAPI DataAdviseHolder_A
* Store the new sink
*/
This->Connections[index].sink = pAdvise;
- memcpy(&(This->Connections[index].fmat), pFetc, sizeof(FORMATETC));
This->Connections[index].advf = advf & ~WINE_ADVF_REMOTE;
+ memcpy(&(This->Connections[index].fmat), pFetc, sizeof(FORMATETC));
+ if (pFetc->ptd)
+ {
+ This->Connections[index].fmat.ptd = CoTaskMemAlloc(pFetc->ptd->tdSize);
+ if (!This->Connections[index].fmat.ptd)
+ {
+ IDataAdviseHolder_Unadvise(iface, index + 1);
+ return E_OUTOFMEMORY;
+ }
+ memcpy(This->Connections[index].fmat.ptd, pFetc->ptd, pFetc->ptd->tdSize);
+ }
if (This->Connections[index].sink != NULL) {
IAdviseSink_AddRef(This->Connections[index].sink);
Module: wine
Branch: master
Commit: 5e9df71e0e1735a60939aa1f931181429ee2afd3
URL: http://source.winehq.org/git/?p=wine.git;a=commit;h=5e9df71e0e1735a60939aa1…
Author: Robert Shearman <rob(a)codeweavers.com>
Date: Thu Aug 31 17:20:09 2006 +0100
ole32: Don't send data changes in DataAdviseHolder_Advise for
ADVF_PRIMEFIRST connections if we are connected to a data object,
since it will send the data change for us.
---
dlls/ole32/oleobj.c | 7 ++++---
1 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/dlls/ole32/oleobj.c b/dlls/ole32/oleobj.c
index 7a00d8f..ae06f18 100644
--- a/dlls/ole32/oleobj.c
+++ b/dlls/ole32/oleobj.c
@@ -728,9 +728,6 @@ static HRESULT WINAPI DataAdviseHolder_A
if (This->Connections[index].sink != NULL) {
IAdviseSink_AddRef(This->Connections[index].sink);
- if(advf & ADVF_PRIMEFIRST) {
- IDataAdviseHolder_SendOnDataChange(iface, pDataObject, 0, advf);
- }
/* if we are already connected advise the remote object */
if (This->delegate)
@@ -748,6 +745,10 @@ static HRESULT WINAPI DataAdviseHolder_A
}
This->Connections[index].advf |= WINE_ADVF_REMOTE;
}
+ else if(advf & ADVF_PRIMEFIRST)
+ /* only do this if we have no delegate, since in the above case the
+ * delegate will do the priming for us */
+ IDataAdviseHolder_SendOnDataChange(iface, pDataObject, 0, advf);
}
/*
* Return the index as the cookie.