winehq.org
Sign In
Sign Up
Sign In
Sign Up
Manage this list
×
Keyboard Shortcuts
Thread View
j
: Next unread message
k
: Previous unread message
j a
: Jump to all threads
j l
: Jump to MailingList overview
2025
February
January
2024
December
November
October
September
August
July
June
May
April
March
February
January
2023
December
November
October
September
August
July
June
May
April
March
February
January
2022
December
November
October
September
August
July
June
May
April
March
February
January
2021
December
November
October
September
August
July
June
May
April
March
February
January
2020
December
November
October
September
August
July
June
May
April
March
February
January
2019
December
November
October
September
August
July
June
May
April
March
February
January
2018
December
November
October
September
August
July
June
May
April
March
February
January
2017
December
November
October
September
August
July
June
May
April
March
February
January
2016
December
November
October
September
August
July
June
May
April
March
February
January
2015
December
November
October
September
August
July
June
May
April
March
February
January
2014
December
November
October
September
August
July
June
May
April
March
February
January
2013
December
November
October
September
August
July
June
May
April
March
February
January
2012
December
November
October
September
August
July
June
May
April
March
February
January
2011
December
November
October
September
August
July
June
May
April
March
February
January
2010
December
November
October
September
August
July
June
May
April
March
February
January
2009
December
November
October
September
August
July
June
May
April
March
February
January
2008
December
November
October
September
August
July
June
May
April
March
February
January
2007
December
November
October
September
August
July
June
May
April
March
February
January
2006
December
November
October
September
August
July
June
May
April
March
February
January
2005
December
November
October
September
August
July
June
May
April
March
February
January
2004
December
November
October
September
August
July
June
May
April
March
February
January
2003
December
November
October
September
August
July
June
May
April
March
February
January
2002
December
November
October
September
August
July
June
May
April
March
February
January
2001
December
November
October
September
August
July
June
May
April
March
February
List overview
wine-commits
June 2011
----- 2025 -----
February 2025
January 2025
----- 2024 -----
December 2024
November 2024
October 2024
September 2024
August 2024
July 2024
June 2024
May 2024
April 2024
March 2024
February 2024
January 2024
----- 2023 -----
December 2023
November 2023
October 2023
September 2023
August 2023
July 2023
June 2023
May 2023
April 2023
March 2023
February 2023
January 2023
----- 2022 -----
December 2022
November 2022
October 2022
September 2022
August 2022
July 2022
June 2022
May 2022
April 2022
March 2022
February 2022
January 2022
----- 2021 -----
December 2021
November 2021
October 2021
September 2021
August 2021
July 2021
June 2021
May 2021
April 2021
March 2021
February 2021
January 2021
----- 2020 -----
December 2020
November 2020
October 2020
September 2020
August 2020
July 2020
June 2020
May 2020
April 2020
March 2020
February 2020
January 2020
----- 2019 -----
December 2019
November 2019
October 2019
September 2019
August 2019
July 2019
June 2019
May 2019
April 2019
March 2019
February 2019
January 2019
----- 2018 -----
December 2018
November 2018
October 2018
September 2018
August 2018
July 2018
June 2018
May 2018
April 2018
March 2018
February 2018
January 2018
----- 2017 -----
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
June 2017
May 2017
April 2017
March 2017
February 2017
January 2017
----- 2016 -----
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
----- 2015 -----
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
----- 2014 -----
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
----- 2013 -----
December 2013
November 2013
October 2013
September 2013
August 2013
July 2013
June 2013
May 2013
April 2013
March 2013
February 2013
January 2013
----- 2012 -----
December 2012
November 2012
October 2012
September 2012
August 2012
July 2012
June 2012
May 2012
April 2012
March 2012
February 2012
January 2012
----- 2011 -----
December 2011
November 2011
October 2011
September 2011
August 2011
July 2011
June 2011
May 2011
April 2011
March 2011
February 2011
January 2011
----- 2010 -----
December 2010
November 2010
October 2010
September 2010
August 2010
July 2010
June 2010
May 2010
April 2010
March 2010
February 2010
January 2010
----- 2009 -----
December 2009
November 2009
October 2009
September 2009
August 2009
July 2009
June 2009
May 2009
April 2009
March 2009
February 2009
January 2009
----- 2008 -----
December 2008
November 2008
October 2008
September 2008
August 2008
July 2008
June 2008
May 2008
April 2008
March 2008
February 2008
January 2008
----- 2007 -----
December 2007
November 2007
October 2007
September 2007
August 2007
July 2007
June 2007
May 2007
April 2007
March 2007
February 2007
January 2007
----- 2006 -----
December 2006
November 2006
October 2006
September 2006
August 2006
July 2006
June 2006
May 2006
April 2006
March 2006
February 2006
January 2006
----- 2005 -----
December 2005
November 2005
October 2005
September 2005
August 2005
July 2005
June 2005
May 2005
April 2005
March 2005
February 2005
January 2005
----- 2004 -----
December 2004
November 2004
October 2004
September 2004
August 2004
July 2004
June 2004
May 2004
April 2004
March 2004
February 2004
January 2004
----- 2003 -----
December 2003
November 2003
October 2003
September 2003
August 2003
July 2003
June 2003
May 2003
April 2003
March 2003
February 2003
January 2003
----- 2002 -----
December 2002
November 2002
October 2002
September 2002
August 2002
July 2002
June 2002
May 2002
April 2002
March 2002
February 2002
January 2002
----- 2001 -----
December 2001
November 2001
October 2001
September 2001
August 2001
July 2001
June 2001
May 2001
April 2001
March 2001
February 2001
wine-commits@winehq.org
2 participants
809 discussions
Start a n
N
ew thread
Jacek Caban : mshtml.idl: Added head element interfaces.
by Alexandre Julliard
21 Jun '11
21 Jun '11
Module: wine Branch: master Commit: 0f8300c407ac9a83336b16b57db70a93cbf6da8a URL:
http://source.winehq.org/git/wine.git/?a=commit;h=0f8300c407ac9a83336b16b57…
Author: Jacek Caban <jacek(a)codeweavers.com> Date: Tue Jun 21 13:46:53 2011 +0200 mshtml.idl: Added head element interfaces. --- include/mshtmdid.h | 6 +++++ include/mshtml.idl | 62 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 68 insertions(+), 0 deletions(-) diff --git a/include/mshtmdid.h b/include/mshtmdid.h index 2dad6fb..ad09bdb 100644 --- a/include/mshtmdid.h +++ b/include/mshtmdid.h @@ -2282,6 +2282,12 @@ /* IHTMLSelectElement4 */ #define DISPID_IHTMLSELECTELEMENT4_NAMEDITEM DISPID_COLLECTION+6 +/* IHTMLHeadElement */ +#define DISPID_IHTMLHEADELEMENT_PROFILE DISPID_HEDELEMS+1 + +/* IHTMLHeadElement2 */ +#define DISPID_IHTMLHEADELEMENT2_IE8_PROFILE DISPID_IE8_HEAD + /* IHTMLRect */ #define DISPID_IHTMLRECT_LEFT DISPID_OMRECT+1 #define DISPID_IHTMLRECT_TOP DISPID_OMRECT+2 diff --git a/include/mshtml.idl b/include/mshtml.idl index c2e0874..575f15f 100644 --- a/include/mshtml.idl +++ b/include/mshtml.idl @@ -9187,6 +9187,68 @@ methods: } /***************************************************************************** + * IHTMLHeadElement interface + */ +[ + odl, + oleautomation, + dual, + uuid(3050f81d-98b5-11cf-bb82-00aa00bdce0b) +] +interface IHTMLHeadElement : IDispatch +{ + [propput, id(DISPID_IHTMLHEADELEMENT_PROFILE), displaybind, bindable] + HRESULT profile([in] BSTR v); + + [propget, id(DISPID_IHTMLHEADELEMENT_PROFILE), displaybind, bindable] + HRESULT profile([retval, out] BSTR *p); +} + +/***************************************************************************** + * IHTMLHeadElement2 interface + */ +[ + odl, + oleautomation, + dual, + uuid(3051042f-98b5-11cf-bb82-00aa00bdce0b) +] +interface IHTMLHeadElement2 : IDispatch +{ + [propput, id(DISPID_IHTMLHEADELEMENT2_IE8_PROFILE), displaybind, bindable] + HRESULT profile([in] BSTR v); + + [propget, id(DISPID_IHTMLHEADELEMENT2_IE8_PROFILE), displaybind, bindable] + HRESULT profile([retval, out] BSTR *p); +} + +/***************************************************************************** + * DispHTMLHeadElement interface + */ +[ + hidden, + uuid(3050f561-98b5-11cf-bb82-00aa00bdce0b) +] +dispinterface DispHTMLHeadElement +{ +properties: +methods: + WINE_HTMLELEMENT_DISPINTERFACE_DECL; + + [propput, id(DISPID_IHTMLHEADELEMENT_PROFILE), displaybind, bindable] + void profile(BSTR v); + + [propget, id(DISPID_IHTMLHEADELEMENT_PROFILE), displaybind, bindable] + BSTR profile(); + + [propput, id(DISPID_IHTMLHEADELEMENT2_IE8_PROFILE), displaybind, bindable] + void ie8_profile(BSTR v); + + [propget, id(DISPID_IHTMLHEADELEMENT2_IE8_PROFILE), displaybind, bindable] + BSTR ie8_profile(); +} + +/***************************************************************************** * DispHTMLUnknownElement interface */ [
1
0
0
0
Michael Stefaniuc : ole32: COM cleanup for the static object ComCatMgrImpl.
by Alexandre Julliard
21 Jun '11
21 Jun '11
Module: wine Branch: master Commit: 7b3d1bbc4ea8d0067b01d5268b0faedfc2cac946 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=7b3d1bbc4ea8d0067b01d5268…
Author: Michael Stefaniuc <mstefani(a)redhat.de> Date: Tue Jun 21 10:38:53 2011 +0200 ole32: COM cleanup for the static object ComCatMgrImpl. --- dlls/ole32/comcat.c | 47 +++++++++++++++++++---------------------------- 1 files changed, 19 insertions(+), 28 deletions(-) diff --git a/dlls/ole32/comcat.c b/dlls/ole32/comcat.c index fe0f7e5..20151ae 100644 --- a/dlls/ole32/comcat.c +++ b/dlls/ole32/comcat.c @@ -36,12 +36,22 @@ WINE_DEFAULT_DEBUG_CHANNEL(ole); +static const ICatRegisterVtbl COMCAT_ICatRegister_Vtbl; +static const ICatInformationVtbl COMCAT_ICatInformation_Vtbl; + typedef struct { - const ICatRegisterVtbl *lpVtbl; - const ICatInformationVtbl *infVtbl; + ICatRegister ICatRegister_iface; + ICatInformation ICatInformation_iface; } ComCatMgrImpl; +/* static ComCatMgr instance */ +static ComCatMgrImpl COMCAT_ComCatMgr = +{ + { &COMCAT_ICatRegister_Vtbl }, + { &COMCAT_ICatInformation_Vtbl } +}; + struct class_categories { LPCWSTR impl_strings; LPCWSTR req_strings; @@ -63,12 +73,6 @@ static const WCHAR req_keyname[] = { static const WCHAR clsid_keyname[] = { 'C','L','S','I','D',0 }; -static inline ComCatMgrImpl *impl_from_ICatInformation( ICatInformation *iface ) -{ - return (ComCatMgrImpl *)((char*)iface - FIELD_OFFSET(ComCatMgrImpl, infVtbl)); -} - - /********************************************************************** * COMCAT_RegisterClassCategories */ @@ -279,20 +283,19 @@ static HRESULT WINAPI COMCAT_ICatRegister_QueryInterface( REFIID riid, LPVOID *ppvObj) { - ComCatMgrImpl *This = (ComCatMgrImpl *)iface; TRACE("%s\n",debugstr_guid(riid)); if (ppvObj == NULL) return E_POINTER; if (IsEqualGUID(riid, &IID_IUnknown) || IsEqualGUID(riid, &IID_ICatRegister)) { *ppvObj = iface; - IUnknown_AddRef(iface); + ICatRegister_AddRef(iface); return S_OK; } if (IsEqualGUID(riid, &IID_ICatInformation)) { - *ppvObj = &This->infVtbl; - IUnknown_AddRef(iface); + *ppvObj = &COMCAT_ComCatMgr.ICatInformation_iface; + ICatRegister_AddRef(iface); return S_OK; } @@ -462,8 +465,7 @@ static HRESULT WINAPI COMCAT_ICatInformation_QueryInterface( REFIID riid, LPVOID *ppvObj) { - ComCatMgrImpl *This = impl_from_ICatInformation( iface ); - return IUnknown_QueryInterface((LPUNKNOWN)This, riid, ppvObj); + return ICatRegister_QueryInterface(&COMCAT_ComCatMgr.ICatRegister_iface, riid, ppvObj); } /********************************************************************** @@ -471,8 +473,7 @@ static HRESULT WINAPI COMCAT_ICatInformation_QueryInterface( */ static ULONG WINAPI COMCAT_ICatInformation_AddRef(LPCATINFORMATION iface) { - ComCatMgrImpl *This = impl_from_ICatInformation( iface ); - return IUnknown_AddRef((LPUNKNOWN)This); + return ICatRegister_AddRef(&COMCAT_ComCatMgr.ICatRegister_iface); } /********************************************************************** @@ -480,8 +481,7 @@ static ULONG WINAPI COMCAT_ICatInformation_AddRef(LPCATINFORMATION iface) */ static ULONG WINAPI COMCAT_ICatInformation_Release(LPCATINFORMATION iface) { - ComCatMgrImpl *This = impl_from_ICatInformation( iface ); - return IUnknown_Release((LPUNKNOWN)This); + return ICatRegister_Release(&COMCAT_ComCatMgr.ICatRegister_iface); } /********************************************************************** @@ -705,15 +705,6 @@ static const ICatInformationVtbl COMCAT_ICatInformation_Vtbl = }; /********************************************************************** - * static ComCatMgr instance - */ -static ComCatMgrImpl COMCAT_ComCatMgr = -{ - &COMCAT_ICatRegister_Vtbl, - &COMCAT_ICatInformation_Vtbl -}; - -/********************************************************************** * COMCAT_IClassFactory_QueryInterface (also IUnknown) */ static HRESULT WINAPI COMCAT_IClassFactory_QueryInterface( @@ -769,7 +760,7 @@ static HRESULT WINAPI COMCAT_IClassFactory_CreateInstance( /* Don't support aggregation (Windows doesn't) */ if (pUnkOuter != NULL) return CLASS_E_NOAGGREGATION; - res = IUnknown_QueryInterface((LPUNKNOWN)&COMCAT_ComCatMgr, riid, ppvObj); + res = ICatRegister_QueryInterface(&COMCAT_ComCatMgr.ICatRegister_iface, riid, ppvObj); if (SUCCEEDED(res)) { return res; }
1
0
0
0
Ričardas Barkauskas : ddraw: Separate IDirectDrawSurface3 reference count.
by Alexandre Julliard
21 Jun '11
21 Jun '11
Module: wine Branch: master Commit: f0634f7a4bf125f1c7221fe675765a7b157d0b92 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=f0634f7a4bf125f1c7221fe67…
Author: Ričardas Barkauskas <rbarkauskas(a)codeweavers.com> Date: Mon Jun 20 23:51:01 2011 +0300 ddraw: Separate IDirectDrawSurface3 reference count. --- dlls/ddraw/ddraw_private.h | 2 +- dlls/ddraw/main.c | 7 +++++-- dlls/ddraw/surface.c | 29 +++++++++++++++++++++++------ dlls/ddraw/tests/dsurface.c | 4 ++-- 4 files changed, 31 insertions(+), 11 deletions(-) diff --git a/dlls/ddraw/ddraw_private.h b/dlls/ddraw/ddraw_private.h index 5d74715..e15219d 100644 --- a/dlls/ddraw/ddraw_private.h +++ b/dlls/ddraw/ddraw_private.h @@ -161,7 +161,7 @@ struct IDirectDrawSurfaceImpl const IDirect3DTexture2Vtbl *IDirect3DTexture2_vtbl; const IDirect3DTextureVtbl *IDirect3DTexture_vtbl; - LONG ref, ref2, iface_count; + LONG ref, ref3, ref2, iface_count; IUnknown *ifaceToRelease; int version; diff --git a/dlls/ddraw/main.c b/dlls/ddraw/main.c index 863c5b0..36c0ef7 100644 --- a/dlls/ddraw/main.c +++ b/dlls/ddraw/main.c @@ -752,12 +752,14 @@ DestroyCallback(IDirectDrawSurface7 *surf, void *context) { IDirectDrawSurfaceImpl *Impl = impl_from_IDirectDrawSurface7(surf); - ULONG ref, ref2; + ULONG ref, ref3, ref2; ref = IDirectDrawSurface7_Release(surf); /* For the EnumSurfaces */ + IDirectDrawSurface3_AddRef(&Impl->IDirectDrawSurface3_iface); + ref3 = IDirectDrawSurface3_Release(&Impl->IDirectDrawSurface3_iface); IDirectDrawSurface2_AddRef(&Impl->IDirectDrawSurface2_iface); ref2 = IDirectDrawSurface2_Release(&Impl->IDirectDrawSurface2_iface); - WARN("Surface %p has an reference counts of %d 2: %d\n", Impl, ref, ref2); + WARN("Surface %p has an reference counts of %d 3: %d 2: %d\n", Impl, ref, ref3, ref2); /* Skip surfaces which are attached somewhere or which are * part of a complex compound. They will get released when destroying @@ -768,6 +770,7 @@ DestroyCallback(IDirectDrawSurface7 *surf, /* Destroy the surface */ while (ref) ref = IDirectDrawSurface7_Release(surf); + while (ref3) ref3 = IDirectDrawSurface3_Release(&Impl->IDirectDrawSurface3_iface); while (ref2) ref2 = IDirectDrawSurface2_Release(&Impl->IDirectDrawSurface2_iface); return DDENUMRET_OK; diff --git a/dlls/ddraw/surface.c b/dlls/ddraw/surface.c index 6204703..412bc29 100644 --- a/dlls/ddraw/surface.c +++ b/dlls/ddraw/surface.c @@ -90,7 +90,7 @@ static HRESULT WINAPI ddraw_surface7_QueryInterface(IDirectDrawSurface7 *iface, } else if (IsEqualGUID(riid, &IID_IDirectDrawSurface3)) { - IUnknown_AddRef(iface); + IDirectDrawSurface3_AddRef(&This->IDirectDrawSurface3_iface); *obj = &This->IDirectDrawSurface3_iface; TRACE("(%p) returning IDirectDrawSurface3 interface at %p\n", This, *obj); return S_OK; @@ -266,9 +266,16 @@ static ULONG WINAPI ddraw_surface4_AddRef(IDirectDrawSurface4 *iface) static ULONG WINAPI ddraw_surface3_AddRef(IDirectDrawSurface3 *iface) { IDirectDrawSurfaceImpl *This = impl_from_IDirectDrawSurface3(iface); - TRACE("iface %p.\n", iface); + ULONG refcount = InterlockedIncrement(&This->ref3); - return ddraw_surface7_AddRef(&This->IDirectDrawSurface7_iface); + TRACE("iface %p increasing refcount to %u.\n", iface, refcount); + + if (refcount == 1) + { + ddraw_surface_add_iface(This); + } + + return refcount; } static ULONG WINAPI ddraw_surface2_AddRef(IDirectDrawSurface2 *iface) @@ -342,7 +349,8 @@ void ddraw_surface_destroy(IDirectDrawSurfaceImpl *This) * because the 2nd surface was addref()ed when the app * called GetAttachedSurface */ - WARN("(%p): Destroying surface with refcounts %d 2: %d\n", This, This->ref, This->ref2); + WARN("(%p): Destroying surface with refcounts %d 3: %d 2: %d\n", This, This->ref, + This->ref3, This->ref2); } if (This->wined3d_surface) @@ -521,9 +529,16 @@ static ULONG WINAPI ddraw_surface4_Release(IDirectDrawSurface4 *iface) static ULONG WINAPI ddraw_surface3_Release(IDirectDrawSurface3 *iface) { IDirectDrawSurfaceImpl *This = impl_from_IDirectDrawSurface3(iface); - TRACE("iface %p.\n", iface); + ULONG refcount = InterlockedDecrement(&This->ref3); - return ddraw_surface7_Release(&This->IDirectDrawSurface7_iface); + TRACE("iface %p decreasing refcount to %u.\n", iface, refcount); + + if (refcount == 0) + { + ddraw_surface_release_iface(This); + } + + return refcount; } static ULONG WINAPI ddraw_surface2_Release(IDirectDrawSurface2 *iface) @@ -740,6 +755,8 @@ static HRESULT WINAPI ddraw_surface3_GetAttachedSurface(IDirectDrawSurface3 *ifa } attachment_impl = impl_from_IDirectDrawSurface7(attachment7); *attachment = &attachment_impl->IDirectDrawSurface3_iface; + ddraw_surface3_AddRef(*attachment); + ddraw_surface7_Release(attachment7); return hr; } diff --git a/dlls/ddraw/tests/dsurface.c b/dlls/ddraw/tests/dsurface.c index 99058ab..4cfe469 100644 --- a/dlls/ddraw/tests/dsurface.c +++ b/dlls/ddraw/tests/dsurface.c @@ -1092,7 +1092,7 @@ static void IFaceRefCount(void) IDirectDrawSurface_QueryInterface(surf, &IID_IDirectDrawSurface3, (void **) &surf3); ref = getRefcount((IUnknown *) surf3); - todo_wine ok(ref == 1, "Refcount is %u, expected 1\n", ref); + ok(ref == 1, "Refcount is %u, expected 1\n", ref); IDirectDrawSurface_QueryInterface(surf, &IID_IDirectDrawSurface4, (void **) &surf4); ref = getRefcount((IUnknown *) surf4); @@ -1148,7 +1148,7 @@ static void IFaceRefCount(void) ok(ref == 0, "Refcount is %u, expected 0\n", ref); ref = IDirectDrawSurface3_Release(surf3); - todo_wine ok(ref == 0, "Refcount is %u, expected 0\n", ref); + ok(ref == 0, "Refcount is %u, expected 0\n", ref); ref = IDirectDrawSurface4_Release(surf4); todo_wine ok(ref == 0, "Refcount is %u, expected 0\n", ref);
1
0
0
0
Ričardas Barkauskas : ddraw: Separate IDirectDrawSurface2 reference count.
by Alexandre Julliard
21 Jun '11
21 Jun '11
Module: wine Branch: master Commit: 167ffc7b4b58b8fe39a9bdeb0f04e0568dc79161 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=167ffc7b4b58b8fe39a9bdeb0…
Author: Ričardas Barkauskas <rbarkauskas(a)codeweavers.com> Date: Sun Jun 19 17:24:32 2011 +0300 ddraw: Separate IDirectDrawSurface2 reference count. --- dlls/ddraw/ddraw_private.h | 2 +- dlls/ddraw/main.c | 9 ++++++--- dlls/ddraw/surface.c | 28 ++++++++++++++++++++++------ dlls/ddraw/tests/dsurface.c | 12 ++++++------ 4 files changed, 35 insertions(+), 16 deletions(-) diff --git a/dlls/ddraw/ddraw_private.h b/dlls/ddraw/ddraw_private.h index 7b00deb..5d74715 100644 --- a/dlls/ddraw/ddraw_private.h +++ b/dlls/ddraw/ddraw_private.h @@ -161,7 +161,7 @@ struct IDirectDrawSurfaceImpl const IDirect3DTexture2Vtbl *IDirect3DTexture2_vtbl; const IDirect3DTextureVtbl *IDirect3DTexture_vtbl; - LONG ref, iface_count; + LONG ref, ref2, iface_count; IUnknown *ifaceToRelease; int version; diff --git a/dlls/ddraw/main.c b/dlls/ddraw/main.c index 7a693ee..863c5b0 100644 --- a/dlls/ddraw/main.c +++ b/dlls/ddraw/main.c @@ -752,10 +752,12 @@ DestroyCallback(IDirectDrawSurface7 *surf, void *context) { IDirectDrawSurfaceImpl *Impl = impl_from_IDirectDrawSurface7(surf); - ULONG ref; + ULONG ref, ref2; ref = IDirectDrawSurface7_Release(surf); /* For the EnumSurfaces */ - WARN("Surface %p has an reference count of %d\n", Impl, ref); + IDirectDrawSurface2_AddRef(&Impl->IDirectDrawSurface2_iface); + ref2 = IDirectDrawSurface2_Release(&Impl->IDirectDrawSurface2_iface); + WARN("Surface %p has an reference counts of %d 2: %d\n", Impl, ref, ref2); /* Skip surfaces which are attached somewhere or which are * part of a complex compound. They will get released when destroying @@ -765,7 +767,8 @@ DestroyCallback(IDirectDrawSurface7 *surf, return DDENUMRET_OK; /* Destroy the surface */ - while(ref) ref = IDirectDrawSurface7_Release(surf); + while (ref) ref = IDirectDrawSurface7_Release(surf); + while (ref2) ref2 = IDirectDrawSurface2_Release(&Impl->IDirectDrawSurface2_iface); return DDENUMRET_OK; } diff --git a/dlls/ddraw/surface.c b/dlls/ddraw/surface.c index fdb199e..6204703 100644 --- a/dlls/ddraw/surface.c +++ b/dlls/ddraw/surface.c @@ -97,7 +97,7 @@ static HRESULT WINAPI ddraw_surface7_QueryInterface(IDirectDrawSurface7 *iface, } else if (IsEqualGUID(riid, &IID_IDirectDrawSurface2)) { - IUnknown_AddRef(iface); + IDirectDrawSurface2_AddRef(&This->IDirectDrawSurface2_iface); *obj = &This->IDirectDrawSurface2_iface; TRACE("(%p) returning IDirectDrawSurface2 interface at %p\n", This, *obj); return S_OK; @@ -274,9 +274,16 @@ static ULONG WINAPI ddraw_surface3_AddRef(IDirectDrawSurface3 *iface) static ULONG WINAPI ddraw_surface2_AddRef(IDirectDrawSurface2 *iface) { IDirectDrawSurfaceImpl *This = impl_from_IDirectDrawSurface2(iface); - TRACE("iface %p.\n", iface); + ULONG refcount = InterlockedIncrement(&This->ref2); - return ddraw_surface7_AddRef(&This->IDirectDrawSurface7_iface); + TRACE("iface %p increasing refcount to %u.\n", iface, refcount); + + if (refcount == 1) + { + ddraw_surface_add_iface(This); + } + + return refcount; } static ULONG WINAPI ddraw_surface1_AddRef(IDirectDrawSurface *iface) @@ -335,7 +342,7 @@ void ddraw_surface_destroy(IDirectDrawSurfaceImpl *This) * because the 2nd surface was addref()ed when the app * called GetAttachedSurface */ - WARN("(%p): Destroying surface with refount %d\n", This, This->ref); + WARN("(%p): Destroying surface with refcounts %d 2: %d\n", This, This->ref, This->ref2); } if (This->wined3d_surface) @@ -522,9 +529,16 @@ static ULONG WINAPI ddraw_surface3_Release(IDirectDrawSurface3 *iface) static ULONG WINAPI ddraw_surface2_Release(IDirectDrawSurface2 *iface) { IDirectDrawSurfaceImpl *This = impl_from_IDirectDrawSurface2(iface); - TRACE("iface %p.\n", iface); + ULONG refcount = InterlockedDecrement(&This->ref2); - return ddraw_surface7_Release(&This->IDirectDrawSurface7_iface); + TRACE("iface %p decreasing refcount to %u.\n", iface, refcount); + + if (refcount == 0) + { + ddraw_surface_release_iface(This); + } + + return refcount; } static ULONG WINAPI ddraw_surface1_Release(IDirectDrawSurface *iface) @@ -755,6 +769,8 @@ static HRESULT WINAPI ddraw_surface2_GetAttachedSurface(IDirectDrawSurface2 *ifa } attachment_impl = impl_from_IDirectDrawSurface7(attachment7); *attachment = &attachment_impl->IDirectDrawSurface2_iface; + ddraw_surface2_AddRef(*attachment); + ddraw_surface7_Release(attachment7); return hr; } diff --git a/dlls/ddraw/tests/dsurface.c b/dlls/ddraw/tests/dsurface.c index 8bc400d..99058ab 100644 --- a/dlls/ddraw/tests/dsurface.c +++ b/dlls/ddraw/tests/dsurface.c @@ -1080,15 +1080,15 @@ static void IFaceRefCount(void) IDirectDrawSurface_QueryInterface(surf, &IID_IDirectDrawSurface2, (void **) &surf2); ref = getRefcount((IUnknown *) surf); - todo_wine ok(ref == 1, "Refcount is %u, expected 1\n", ref); /* Check the ref count is one */ + ok(ref == 1, "Refcount is %u, expected 1\n", ref); /* Check the ref count is one */ ref = getRefcount((IUnknown *) surf2); - todo_wine ok(ref == 1, "Refcount is %u, expected 1\n", ref); /* This should also be one */ + ok(ref == 1, "Refcount is %u, expected 1\n", ref); /* This should also be one */ IDirectDrawSurface_QueryInterface(surf, &IID_IDirectDrawSurface2, (void **) &surf2a); ref = getRefcount((IUnknown *) surf2); - todo_wine ok(ref == 2, "Refcount is %u, expected 2\n", ref); /* Surf2's refcount should be 2 now, but surf should be 1 */ + ok(ref == 2, "Refcount is %u, expected 2\n", ref); /* Surf2's refcount should be 2 now, but surf should be 1 */ ref = getRefcount((IUnknown *) surf); - todo_wine ok(ref == 1, "Refcount is %u, expected 1\n", ref); + ok(ref == 1, "Refcount is %u, expected 1\n", ref); IDirectDrawSurface_QueryInterface(surf, &IID_IDirectDrawSurface3, (void **) &surf3); ref = getRefcount((IUnknown *) surf3); @@ -1142,10 +1142,10 @@ static void IFaceRefCount(void) } ref = IDirectDrawSurface2_Release(surf2); /* Release one of the 2 surf2 interfaces */ - todo_wine ok(ref == 1, "Refcount is %u, expected 1\n", ref); + ok(ref == 1, "Refcount is %u, expected 1\n", ref); ref = IDirectDrawSurface2_Release(surf2a); /* Release the other */ - todo_wine ok(ref == 0, "Refcount is %u, expected 0\n", ref); + ok(ref == 0, "Refcount is %u, expected 0\n", ref); ref = IDirectDrawSurface3_Release(surf3); todo_wine ok(ref == 0, "Refcount is %u, expected 0\n", ref);
1
0
0
0
Ričardas Barkauskas : ddraw: Test ddraw surface reference counts a bit more.
by Alexandre Julliard
21 Jun '11
21 Jun '11
Module: wine Branch: master Commit: a9f72a3067b049fea2e9d8fc554137b5d1b5977f URL:
http://source.winehq.org/git/wine.git/?a=commit;h=a9f72a3067b049fea2e9d8fc5…
Author: Ričardas Barkauskas <rbarkauskas(a)codeweavers.com> Date: Tue Jun 21 00:40:54 2011 +0300 ddraw: Test ddraw surface reference counts a bit more. --- dlls/ddraw/tests/dsurface.c | 21 +++++++++++++++++++++ 1 files changed, 21 insertions(+), 0 deletions(-) diff --git a/dlls/ddraw/tests/dsurface.c b/dlls/ddraw/tests/dsurface.c index 7416c93..8bc400d 100644 --- a/dlls/ddraw/tests/dsurface.c +++ b/dlls/ddraw/tests/dsurface.c @@ -1053,6 +1053,7 @@ static void IFaceRefCount(void) HRESULT ret; IDirectDrawSurface2 *surf2; IDirectDrawSurface2 *surf2a; + IDirectDrawSurface3 *surf3; IDirectDrawSurface4 *surf4; IDirectDrawSurface7 *surf7a; IDirectDrawSurface7 *surf7b; @@ -1089,6 +1090,10 @@ static void IFaceRefCount(void) ref = getRefcount((IUnknown *) surf); todo_wine ok(ref == 1, "Refcount is %u, expected 1\n", ref); + IDirectDrawSurface_QueryInterface(surf, &IID_IDirectDrawSurface3, (void **) &surf3); + ref = getRefcount((IUnknown *) surf3); + todo_wine ok(ref == 1, "Refcount is %u, expected 1\n", ref); + IDirectDrawSurface_QueryInterface(surf, &IID_IDirectDrawSurface4, (void **) &surf4); ref = getRefcount((IUnknown *) surf4); todo_wine ok(ref == 1, "Refcount is %u, expected 1\n", ref); @@ -1142,6 +1147,9 @@ static void IFaceRefCount(void) ref = IDirectDrawSurface2_Release(surf2a); /* Release the other */ todo_wine ok(ref == 0, "Refcount is %u, expected 0\n", ref); + ref = IDirectDrawSurface3_Release(surf3); + todo_wine ok(ref == 0, "Refcount is %u, expected 0\n", ref); + ref = IDirectDrawSurface4_Release(surf4); todo_wine ok(ref == 0, "Refcount is %u, expected 0\n", ref); @@ -3080,6 +3088,7 @@ static void GetDCTest(void) IDirectDraw4 *dd4; IDirectDraw7 *dd7; HDC dc; + ULONG ref; memset(&ddsd, 0, sizeof(ddsd)); ddsd.dwSize = sizeof(ddsd); @@ -3125,6 +3134,11 @@ static void GetDCTest(void) hr = IDirectDrawSurface4_QueryInterface(surf4, &IID_IDirectDrawSurface, (void **)&surf); ok(SUCCEEDED(hr), "QueryInterface failed, hr %#x.\n", hr); + ref = getRefcount((IUnknown *) surf); + todo_wine ok(ref == 1, "Refcount is %u, expected 1\n", ref); + ref = getRefcount((IUnknown *) surf4); + todo_wine ok(ref == 1, "Refcount is %u, expected 1\n", ref); + hr = IDirectDrawSurface4_GetDC(surf4, &dc); ok(SUCCEEDED(hr), "GetDC failed, hr %#x.\n", hr); @@ -3135,6 +3149,13 @@ static void GetDCTest(void) ok(SUCCEEDED(hr), "GetSurfaceFromDC failed, hr %#x.\n", hr); ok(tmp == surf, "Expected surface %p, got %p.\n\n", surf, tmp); + ref = getRefcount((IUnknown *) surf); + todo_wine ok(ref == 2, "Refcount is %u, expected 2\n", ref); + ref = getRefcount((IUnknown *) tmp); + todo_wine ok(ref == 2, "Refcount is %u, expected 2\n", ref); + ref = getRefcount((IUnknown *) surf4); + todo_wine ok(ref == 1, "Refcount is %u, expected 1\n", ref); + hr = IDirectDrawSurface4_ReleaseDC(surf4, dc); ok(SUCCEEDED(hr), "ReleaseDC failed, hr %#x.\n", hr);
1
0
0
0
Ričardas Barkauskas : ddraw: Use helper function to delete attached surfaces.
by Alexandre Julliard
21 Jun '11
21 Jun '11
Module: wine Branch: master Commit: 104e68da459490a6e348620651fc181c2177fc9b URL:
http://source.winehq.org/git/wine.git/?a=commit;h=104e68da459490a6e34862065…
Author: Ričardas Barkauskas <rbarkauskas(a)codeweavers.com> Date: Mon Jun 20 23:46:26 2011 +0300 ddraw: Use helper function to delete attached surfaces. --- dlls/ddraw/surface.c | 69 +++++++++++++++++++++++++++++++++++++++----------- 1 files changed, 54 insertions(+), 15 deletions(-) diff --git a/dlls/ddraw/surface.c b/dlls/ddraw/surface.c index 36c4084..fdb199e 100644 --- a/dlls/ddraw/surface.c +++ b/dlls/ddraw/surface.c @@ -1452,14 +1452,12 @@ static HRESULT WINAPI ddraw_surface1_AddAttachedSurface(IDirectDrawSurface *ifac * DDERR_SURFACENOTATTACHED if the surface isn't attached to * *****************************************************************************/ -static HRESULT WINAPI ddraw_surface7_DeleteAttachedSurface(IDirectDrawSurface7 *iface, - DWORD Flags, IDirectDrawSurface7 *Attach) +static HRESULT ddraw_surface_delete_attached_surface(IDirectDrawSurfaceImpl *This, + IDirectDrawSurfaceImpl *Surf) { - IDirectDrawSurfaceImpl *This = impl_from_IDirectDrawSurface7(iface); - IDirectDrawSurfaceImpl *Surf = unsafe_impl_from_IDirectDrawSurface7(Attach); IDirectDrawSurfaceImpl *Prev = This; - TRACE("iface %p, flags %#x, attachment %p.\n", iface, Flags, Attach); + TRACE("surface %p, attachment %p.\n", This, Surf); EnterCriticalSection(&ddraw_cs); if (!Surf || (Surf->first_attached != This) || (Surf == This) ) @@ -1497,21 +1495,44 @@ static HRESULT WINAPI ddraw_surface7_DeleteAttachedSurface(IDirectDrawSurface7 * { IDirect3DDeviceImpl_UpdateDepthStencil(This->ddraw->d3ddevice); } - - ddraw_surface7_Release(Attach); LeaveCriticalSection(&ddraw_cs); return DD_OK; } +static HRESULT WINAPI ddraw_surface7_DeleteAttachedSurface(IDirectDrawSurface7 *iface, + DWORD flags, IDirectDrawSurface7 *attachment) +{ + IDirectDrawSurfaceImpl *This = impl_from_IDirectDrawSurface7(iface); + IDirectDrawSurfaceImpl *attachment_impl = unsafe_impl_from_IDirectDrawSurface7(attachment); + HRESULT hr; + + TRACE("iface %p, flags %#x, attachment %p.\n", iface, flags, attachment); + + hr = ddraw_surface_delete_attached_surface(This, attachment_impl); + if (FAILED(hr)) + { + return hr; + } + ddraw_surface7_Release(attachment); + return hr; +} + static HRESULT WINAPI ddraw_surface4_DeleteAttachedSurface(IDirectDrawSurface4 *iface, DWORD flags, IDirectDrawSurface4 *attachment) { IDirectDrawSurfaceImpl *This = impl_from_IDirectDrawSurface4(iface); IDirectDrawSurfaceImpl *attachment_impl = unsafe_impl_from_IDirectDrawSurface4(attachment); + HRESULT hr; + TRACE("iface %p, flags %#x, attachment %p.\n", iface, flags, attachment); - return ddraw_surface7_DeleteAttachedSurface(&This->IDirectDrawSurface7_iface, flags, - attachment_impl ? &attachment_impl->IDirectDrawSurface7_iface : NULL); + hr = ddraw_surface_delete_attached_surface(This, attachment_impl); + if (FAILED(hr)) + { + return hr; + } + ddraw_surface4_Release(attachment); + return hr; } static HRESULT WINAPI ddraw_surface3_DeleteAttachedSurface(IDirectDrawSurface3 *iface, @@ -1519,10 +1540,16 @@ static HRESULT WINAPI ddraw_surface3_DeleteAttachedSurface(IDirectDrawSurface3 * { IDirectDrawSurfaceImpl *This = impl_from_IDirectDrawSurface3(iface); IDirectDrawSurfaceImpl *attachment_impl = unsafe_impl_from_IDirectDrawSurface3(attachment); + HRESULT hr; TRACE("iface %p, flags %#x, attachment %p.\n", iface, flags, attachment); - return ddraw_surface7_DeleteAttachedSurface(&This->IDirectDrawSurface7_iface, flags, - attachment_impl ? &attachment_impl->IDirectDrawSurface7_iface : NULL); + hr = ddraw_surface_delete_attached_surface(This, attachment_impl); + if (FAILED(hr)) + { + return hr; + } + ddraw_surface3_Release(attachment); + return hr; } static HRESULT WINAPI ddraw_surface2_DeleteAttachedSurface(IDirectDrawSurface2 *iface, @@ -1530,10 +1557,16 @@ static HRESULT WINAPI ddraw_surface2_DeleteAttachedSurface(IDirectDrawSurface2 * { IDirectDrawSurfaceImpl *This = impl_from_IDirectDrawSurface2(iface); IDirectDrawSurfaceImpl *attachment_impl = unsafe_impl_from_IDirectDrawSurface2(attachment); + HRESULT hr; TRACE("iface %p, flags %#x, attachment %p.\n", iface, flags, attachment); - return ddraw_surface7_DeleteAttachedSurface(&This->IDirectDrawSurface7_iface, flags, - attachment_impl ? &attachment_impl->IDirectDrawSurface7_iface : NULL); + hr = ddraw_surface_delete_attached_surface(This, attachment_impl); + if (FAILED(hr)) + { + return hr; + } + ddraw_surface2_Release(attachment); + return hr; } static HRESULT WINAPI ddraw_surface1_DeleteAttachedSurface(IDirectDrawSurface *iface, @@ -1541,10 +1574,16 @@ static HRESULT WINAPI ddraw_surface1_DeleteAttachedSurface(IDirectDrawSurface *i { IDirectDrawSurfaceImpl *This = impl_from_IDirectDrawSurface(iface); IDirectDrawSurfaceImpl *attachment_impl = unsafe_impl_from_IDirectDrawSurface(attachment); + HRESULT hr; TRACE("iface %p, flags %#x, attachment %p.\n", iface, flags, attachment); - return ddraw_surface7_DeleteAttachedSurface(&This->IDirectDrawSurface7_iface, flags, - attachment_impl ? &attachment_impl->IDirectDrawSurface7_iface : NULL); + hr = ddraw_surface_delete_attached_surface(This, attachment_impl); + if (FAILED(hr)) + { + return hr; + } + ddraw_surface1_Release(attachment); + return hr; } /*****************************************************************************
1
0
0
0
Ričardas Barkauskas : ddraw: AddRef the surface in AddAttachedSurface instead of helper function.
by Alexandre Julliard
21 Jun '11
21 Jun '11
Module: wine Branch: master Commit: ec754ab98b3f120aad154c06b4b9040181c9fb34 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=ec754ab98b3f120aad154c06b…
Author: Ričardas Barkauskas <rbarkauskas(a)codeweavers.com> Date: Tue Jun 21 00:30:12 2011 +0300 ddraw: AddRef the surface in AddAttachedSurface instead of helper function. --- dlls/ddraw/surface.c | 49 +++++++++++++++++++++++++++++++++++++++++++------ 1 files changed, 43 insertions(+), 6 deletions(-) diff --git a/dlls/ddraw/surface.c b/dlls/ddraw/surface.c index ca9f333..36c4084 100644 --- a/dlls/ddraw/surface.c +++ b/dlls/ddraw/surface.c @@ -1306,7 +1306,6 @@ static HRESULT ddraw_surface_attach_surface(IDirectDrawSurfaceImpl *This, IDirec IDirect3DDeviceImpl_UpdateDepthStencil(This->ddraw->d3ddevice); } - ddraw_surface7_AddRef(&Surf->IDirectDrawSurface7_iface); LeaveCriticalSection(&ddraw_cs); return DD_OK; } @@ -1315,6 +1314,7 @@ static HRESULT WINAPI ddraw_surface7_AddAttachedSurface(IDirectDrawSurface7 *ifa { IDirectDrawSurfaceImpl *This = impl_from_IDirectDrawSurface7(iface); IDirectDrawSurfaceImpl *Surf = unsafe_impl_from_IDirectDrawSurface7(Attach); + HRESULT hr; TRACE("iface %p, attachment %p.\n", iface, Attach); @@ -1327,23 +1327,38 @@ static HRESULT WINAPI ddraw_surface7_AddAttachedSurface(IDirectDrawSurface7 *ifa return DDERR_CANNOTATTACHSURFACE; } - return ddraw_surface_attach_surface(This, Surf); + hr = ddraw_surface_attach_surface(This, Surf); + if (FAILED(hr)) + { + return hr; + } + ddraw_surface7_AddRef(Attach); + return hr; } static HRESULT WINAPI ddraw_surface4_AddAttachedSurface(IDirectDrawSurface4 *iface, IDirectDrawSurface4 *attachment) { IDirectDrawSurfaceImpl *This = impl_from_IDirectDrawSurface4(iface); IDirectDrawSurfaceImpl *attachment_impl = unsafe_impl_from_IDirectDrawSurface4(attachment); + HRESULT hr; TRACE("iface %p, attachment %p.\n", iface, attachment); - return ddraw_surface7_AddAttachedSurface(&This->IDirectDrawSurface7_iface, + hr = ddraw_surface7_AddAttachedSurface(&This->IDirectDrawSurface7_iface, attachment_impl ? &attachment_impl->IDirectDrawSurface7_iface : NULL); + if (FAILED(hr)) + { + return hr; + } + ddraw_surface4_AddRef(attachment); + ddraw_surface7_Release(&attachment_impl->IDirectDrawSurface7_iface); + return hr; } static HRESULT WINAPI ddraw_surface3_AddAttachedSurface(IDirectDrawSurface3 *iface, IDirectDrawSurface3 *attachment) { IDirectDrawSurfaceImpl *This = impl_from_IDirectDrawSurface3(iface); IDirectDrawSurfaceImpl *attach_impl = unsafe_impl_from_IDirectDrawSurface3(attachment); + HRESULT hr; TRACE("iface %p, attachment %p.\n", iface, attachment); @@ -1375,29 +1390,51 @@ static HRESULT WINAPI ddraw_surface3_AddAttachedSurface(IDirectDrawSurface3 *ifa return DDERR_CANNOTATTACHSURFACE; } - return ddraw_surface_attach_surface(This, attach_impl); + hr = ddraw_surface_attach_surface(This, attach_impl); + if (FAILED(hr)) + { + return hr; + } + ddraw_surface3_AddRef(attachment); + return hr; } static HRESULT WINAPI ddraw_surface2_AddAttachedSurface(IDirectDrawSurface2 *iface, IDirectDrawSurface2 *attachment) { IDirectDrawSurfaceImpl *This = impl_from_IDirectDrawSurface2(iface); IDirectDrawSurfaceImpl *attachment_impl = unsafe_impl_from_IDirectDrawSurface2(attachment); + HRESULT hr; TRACE("iface %p, attachment %p.\n", iface, attachment); - return ddraw_surface3_AddAttachedSurface(&This->IDirectDrawSurface3_iface, + hr = ddraw_surface3_AddAttachedSurface(&This->IDirectDrawSurface3_iface, attachment_impl ? &attachment_impl->IDirectDrawSurface3_iface : NULL); + if (FAILED(hr)) + { + return hr; + } + ddraw_surface2_AddRef(attachment); + ddraw_surface3_Release(&attachment_impl->IDirectDrawSurface3_iface); + return hr; } static HRESULT WINAPI ddraw_surface1_AddAttachedSurface(IDirectDrawSurface *iface, IDirectDrawSurface *attachment) { IDirectDrawSurfaceImpl *This = impl_from_IDirectDrawSurface(iface); IDirectDrawSurfaceImpl *attachment_impl = unsafe_impl_from_IDirectDrawSurface(attachment); + HRESULT hr; TRACE("iface %p, attachment %p.\n", iface, attachment); - return ddraw_surface3_AddAttachedSurface(&This->IDirectDrawSurface3_iface, + hr = ddraw_surface3_AddAttachedSurface(&This->IDirectDrawSurface3_iface, attachment_impl ? &attachment_impl->IDirectDrawSurface3_iface : NULL); + if (FAILED(hr)) + { + return hr; + } + ddraw_surface1_AddRef(attachment); + ddraw_surface3_Release(&attachment_impl->IDirectDrawSurface3_iface); + return hr; } /*****************************************************************************
1
0
0
0
Ričardas Barkauskas : ddraw: Add iface count for IDirectSurfaceImpl.
by Alexandre Julliard
21 Jun '11
21 Jun '11
Module: wine Branch: master Commit: 4b8fd522f66d2554563f906663653f3ce6c1553c URL:
http://source.winehq.org/git/wine.git/?a=commit;h=4b8fd522f66d2554563f90666…
Author: Ričardas Barkauskas <rbarkauskas(a)codeweavers.com> Date: Sun Jun 19 13:18:22 2011 +0300 ddraw: Add iface count for IDirectSurfaceImpl. --- dlls/ddraw/ddraw_private.h | 2 +- dlls/ddraw/surface.c | 83 ++++++++++++++++++++++++++++--------------- 2 files changed, 55 insertions(+), 30 deletions(-) diff --git a/dlls/ddraw/ddraw_private.h b/dlls/ddraw/ddraw_private.h index 9cfbd0e..7b00deb 100644 --- a/dlls/ddraw/ddraw_private.h +++ b/dlls/ddraw/ddraw_private.h @@ -161,7 +161,7 @@ struct IDirectDrawSurfaceImpl const IDirect3DTexture2Vtbl *IDirect3DTexture2_vtbl; const IDirect3DTextureVtbl *IDirect3DTexture_vtbl; - LONG ref; + LONG ref, iface_count; IUnknown *ifaceToRelease; int version; diff --git a/dlls/ddraw/surface.c b/dlls/ddraw/surface.c index 4370ff7..ca9f333 100644 --- a/dlls/ddraw/surface.c +++ b/dlls/ddraw/surface.c @@ -215,6 +215,22 @@ static HRESULT WINAPI d3d_texture1_QueryInterface(IDirect3DTexture *iface, REFII return ddraw_surface7_QueryInterface(&This->IDirectDrawSurface7_iface, riid, object); } +static void ddraw_surface_add_iface(IDirectDrawSurfaceImpl *This) +{ + ULONG iface_count = InterlockedIncrement(&This->iface_count); + TRACE("%p increasing iface count to %u.\n", This, iface_count); + + if (iface_count == 1) + { + EnterCriticalSection(&ddraw_cs); + if (This->wined3d_surface) + wined3d_surface_incref(This->wined3d_surface); + if (This->wined3d_texture) + wined3d_texture_incref(This->wined3d_texture); + LeaveCriticalSection(&ddraw_cs); + } +} + /***************************************************************************** * IDirectDrawSurface7::AddRef * @@ -227,21 +243,16 @@ static HRESULT WINAPI d3d_texture1_QueryInterface(IDirect3DTexture *iface, REFII static ULONG WINAPI ddraw_surface7_AddRef(IDirectDrawSurface7 *iface) { IDirectDrawSurfaceImpl *This = impl_from_IDirectDrawSurface7(iface); - ULONG refCount = InterlockedIncrement(&This->ref); + ULONG refcount = InterlockedIncrement(&This->ref); - TRACE("%p increasing refcount to %u.\n", This, refCount); + TRACE("iface %p increasing refcount to %u.\n", iface, refcount); - if (refCount == 1) + if (refcount == 1) { - EnterCriticalSection(&ddraw_cs); - if (This->wined3d_surface) - wined3d_surface_incref(This->wined3d_surface); - if (This->wined3d_texture) - wined3d_texture_incref(This->wined3d_texture); - LeaveCriticalSection(&ddraw_cs); + ddraw_surface_add_iface(This); } - return refCount; + return refcount; } static ULONG WINAPI ddraw_surface4_AddRef(IDirectDrawSurface4 *iface) @@ -317,8 +328,8 @@ void ddraw_surface_destroy(IDirectDrawSurfaceImpl *This) { TRACE("surface %p.\n", This); - /* Check the refcount and give a warning */ - if(This->ref > 1) + /* Check the iface count and give a warning */ + if(This->iface_count > 1) { /* This can happen when a complex surface is destroyed, * because the 2nd surface was addref()ed when the app @@ -423,6 +434,31 @@ static void ddraw_surface_cleanup(IDirectDrawSurfaceImpl *surface) IUnknown_Release(ifaceToRelease); } +static void ddraw_surface_release_iface(IDirectDrawSurfaceImpl *This) +{ + ULONG iface_count = InterlockedDecrement(&This->iface_count); + TRACE("%p decreasing iface count to %u.\n", This, iface_count); + + if (iface_count == 0) + { + /* Complex attached surfaces are destroyed implicitly when the root is released */ + EnterCriticalSection(&ddraw_cs); + if(!This->is_complex_root) + { + WARN("(%p) Attempt to destroy a surface that is not a complex root\n", This); + LeaveCriticalSection(&ddraw_cs); + return; + } + if (This->wined3d_texture) /* If it's a texture, destroy the wined3d texture. */ + wined3d_texture_decref(This->wined3d_texture); + else + ddraw_surface_cleanup(This); + LeaveCriticalSection(&ddraw_cs); + } + + return; +} + /***************************************************************************** * IDirectDrawSurface7::Release * @@ -455,28 +491,16 @@ static void ddraw_surface_cleanup(IDirectDrawSurfaceImpl *surface) static ULONG WINAPI ddraw_surface7_Release(IDirectDrawSurface7 *iface) { IDirectDrawSurfaceImpl *This = impl_from_IDirectDrawSurface7(iface); - ULONG ref = InterlockedDecrement(&This->ref); + ULONG refcount = InterlockedDecrement(&This->ref); - TRACE("%p decreasing refcount to %u.\n", This, ref); + TRACE("iface %p decreasing refcount to %u.\n", iface, refcount); - if (ref == 0) + if (refcount == 0) { - /* Complex attached surfaces are destroyed implicitly when the root is released */ - EnterCriticalSection(&ddraw_cs); - if(!This->is_complex_root) - { - WARN("(%p) Attempt to destroy a surface that is not a complex root\n", This); - LeaveCriticalSection(&ddraw_cs); - return ref; - } - if (This->wined3d_texture) /* If it's a texture, destroy the wined3d texture. */ - wined3d_texture_decref(This->wined3d_texture); - else - ddraw_surface_cleanup(This); - LeaveCriticalSection(&ddraw_cs); + ddraw_surface_release_iface(This); } - return ref; + return refcount; } static ULONG WINAPI ddraw_surface4_Release(IDirectDrawSurface4 *iface) @@ -5005,6 +5029,7 @@ HRESULT ddraw_surface_init(IDirectDrawSurfaceImpl *surface, IDirectDrawImpl *ddr surface->IDirect3DTexture2_vtbl = &d3d_texture2_vtbl; surface->IDirect3DTexture_vtbl = &d3d_texture1_vtbl; surface->ref = 1; + surface->iface_count = 1; surface->version = version; surface->ddraw = ddraw;
1
0
0
0
Ričardas Barkauskas : ddraw: Remove ddraw_set_surface_version and set surface version when initialising it .
by Alexandre Julliard
21 Jun '11
21 Jun '11
Module: wine Branch: master Commit: 8959a1395acffb02e98da598352fb0d536ef195c URL:
http://source.winehq.org/git/wine.git/?a=commit;h=8959a1395acffb02e98da5983…
Author: Ričardas Barkauskas <rbarkauskas(a)codeweavers.com> Date: Mon Jun 20 09:30:39 2011 +0300 ddraw: Remove ddraw_set_surface_version and set surface version when initialising it. --- dlls/ddraw/ddraw.c | 70 ++++++++++++++++++------------------------- dlls/ddraw/ddraw_private.h | 2 +- dlls/ddraw/surface.c | 4 +- 3 files changed, 32 insertions(+), 44 deletions(-) Diff:
http://source.winehq.org/git/wine.git/?a=commitdiff;h=8959a1395acffb02e98da…
1
0
0
0
Piotr Pawlow : wined3d: Use a separate mutex for wndproc_table access.
by Alexandre Julliard
21 Jun '11
21 Jun '11
Module: wine Branch: master Commit: b5e04640cc358dda13f70961c31295b522611577 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=b5e04640cc358dda13f70961c…
Author: Piotr Pawlow <pp(a)siedziba.pl> Date: Fri Jun 17 21:49:38 2011 +0200 wined3d: Use a separate mutex for wndproc_table access. If CreateDevice is called with hFocusWindow belonging to another thread, then any code that does SendMessage (or equivalent) to the window while holding the main wined3d mutex causes a deadlock, because wined3d_wndproc tries to acquire the same mutex for wndproc_table access. --- dlls/wined3d/wined3d_main.c | 44 +++++++++++++++++++++++++++++++----------- 1 files changed, 32 insertions(+), 12 deletions(-) diff --git a/dlls/wined3d/wined3d_main.c b/dlls/wined3d/wined3d_main.c index 4f7b1cb..ad3643d 100644 --- a/dlls/wined3d/wined3d_main.c +++ b/dlls/wined3d/wined3d_main.c @@ -60,6 +60,16 @@ static CRITICAL_SECTION_DEBUG wined3d_cs_debug = }; static CRITICAL_SECTION wined3d_cs = {&wined3d_cs_debug, -1, 0, 0, 0, 0}; +static CRITICAL_SECTION wined3d_wndproc_cs; +static CRITICAL_SECTION_DEBUG wined3d_wndproc_cs_debug = +{ + 0, 0, &wined3d_wndproc_cs, + {&wined3d_wndproc_cs_debug.ProcessLocksList, + &wined3d_wndproc_cs_debug.ProcessLocksList}, + 0, 0, {(DWORD_PTR)(__FILE__ ": wined3d_wndproc_cs")} +}; +static CRITICAL_SECTION wined3d_wndproc_cs = {&wined3d_wndproc_cs_debug, -1, 0, 0, 0, 0}; + /* When updating default value here, make sure to update winecfg as well, * where appropriate. */ struct wined3d_settings wined3d_settings = @@ -381,6 +391,16 @@ void WINAPI wined3d_mutex_unlock(void) LeaveCriticalSection(&wined3d_cs); } +static void wined3d_wndproc_mutex_lock(void) +{ + EnterCriticalSection(&wined3d_wndproc_cs); +} + +static void wined3d_wndproc_mutex_unlock(void) +{ + LeaveCriticalSection(&wined3d_wndproc_cs); +} + static struct wined3d_wndproc *wined3d_find_wndproc(HWND window) { unsigned int i; @@ -403,12 +423,12 @@ static LRESULT CALLBACK wined3d_wndproc(HWND window, UINT message, WPARAM wparam BOOL unicode; WNDPROC proc; - wined3d_mutex_lock(); + wined3d_wndproc_mutex_lock(); entry = wined3d_find_wndproc(window); if (!entry) { - wined3d_mutex_unlock(); + wined3d_wndproc_mutex_unlock(); ERR("Window %p is not registered with wined3d.\n", window); return DefWindowProcW(window, message, wparam, lparam); } @@ -416,7 +436,7 @@ static LRESULT CALLBACK wined3d_wndproc(HWND window, UINT message, WPARAM wparam device = entry->device; unicode = entry->unicode; proc = entry->proc; - wined3d_mutex_unlock(); + wined3d_wndproc_mutex_unlock(); return device_process_message(device, window, unicode, message, wparam, lparam, proc); } @@ -425,11 +445,11 @@ BOOL wined3d_register_window(HWND window, struct wined3d_device *device) { struct wined3d_wndproc *entry; - wined3d_mutex_lock(); + wined3d_wndproc_mutex_lock(); if (wined3d_find_wndproc(window)) { - wined3d_mutex_unlock(); + wined3d_wndproc_mutex_unlock(); WARN("Window %p is already registered with wined3d.\n", window); return TRUE; } @@ -444,7 +464,7 @@ BOOL wined3d_register_window(HWND window, struct wined3d_device *device) if (!new_entries) { - wined3d_mutex_unlock(); + wined3d_wndproc_mutex_unlock(); ERR("Failed to grow table.\n"); return FALSE; } @@ -465,7 +485,7 @@ BOOL wined3d_register_window(HWND window, struct wined3d_device *device) entry->proc = (WNDPROC)SetWindowLongPtrA(window, GWLP_WNDPROC, (LONG_PTR)wined3d_wndproc); entry->device = device; - wined3d_mutex_unlock(); + wined3d_wndproc_mutex_unlock(); return TRUE; } @@ -475,11 +495,11 @@ void wined3d_unregister_window(HWND window) struct wined3d_wndproc *entry, *last; LONG_PTR proc; - wined3d_mutex_lock(); + wined3d_wndproc_mutex_lock(); if (!(entry = wined3d_find_wndproc(window))) { - wined3d_mutex_unlock(); + wined3d_wndproc_mutex_unlock(); ERR("Window %p is not registered with wined3d.\n", window); return; } @@ -489,7 +509,7 @@ void wined3d_unregister_window(HWND window) proc = GetWindowLongPtrW(window, GWLP_WNDPROC); if (proc != (LONG_PTR)wined3d_wndproc) { - wined3d_mutex_unlock(); + wined3d_wndproc_mutex_unlock(); WARN("Not unregistering window %p, window proc %#lx doesn't match wined3d window proc %p.\n", window, proc, wined3d_wndproc); return; @@ -502,7 +522,7 @@ void wined3d_unregister_window(HWND window) proc = GetWindowLongPtrA(window, GWLP_WNDPROC); if (proc != (LONG_PTR)wined3d_wndproc) { - wined3d_mutex_unlock(); + wined3d_wndproc_mutex_unlock(); WARN("Not unregistering window %p, window proc %#lx doesn't match wined3d window proc %p.\n", window, proc, wined3d_wndproc); return; @@ -514,7 +534,7 @@ void wined3d_unregister_window(HWND window) last = &wndproc_table.entries[--wndproc_table.count]; if (entry != last) *entry = *last; - wined3d_mutex_unlock(); + wined3d_wndproc_mutex_unlock(); } /* At process attach */
1
0
0
0
← Newer
1
...
20
21
22
23
24
25
26
...
81
Older →
Jump to page:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
Results per page:
10
25
50
100
200