Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
02e9c999
Commit
02e9c999
authored
Apr 13, 2013
by
Michael Stefaniuc
Committed by
Alexandre Julliard
Apr 15, 2013
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dplayx: IDirectPlayLobby3 / IDirectPlayLobby3A have independent refcounts.
parent
f8c77fbd
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
43 additions
and
40 deletions
+43
-40
dplobby.c
dlls/dplayx/dplobby.c
+42
-39
dplayx.c
dlls/dplayx/tests/dplayx.c
+1
-1
No files found.
dlls/dplayx/dplobby.c
View file @
02e9c999
...
...
@@ -83,7 +83,8 @@ typedef struct IDirectPlayLobbyImpl
{
IDirectPlayLobby3
IDirectPlayLobby3_iface
;
IDirectPlayLobby3A
IDirectPlayLobby3A_iface
;
LONG
ulInterfaceRef
;
LONG
numIfaces
;
/* "in use interfaces" refcount */
LONG
ref3
,
ref3A
;
CRITICAL_SECTION
lock
;
DirectPlayLobbyData
*
dpl
;
}
IDirectPlayLobbyImpl
;
...
...
@@ -152,40 +153,12 @@ static HRESULT WINAPI DPL_QueryInterface( IDirectPlayLobbyImpl *This, REFIID rii
return
S_OK
;
}
/*
* Simple procedure. Just increment the reference count to this
* structure and return the new reference count.
*/
static
ULONG
WINAPI
DPL_AddRef
(
IDirectPlayLobbyImpl
*
This
)
{
ULONG
ulInterfaceRefCount
=
InterlockedIncrement
(
&
This
->
ulInterfaceRef
);
TRACE
(
"ref count incremented to %u for %p
\n
"
,
ulInterfaceRefCount
,
This
);
return
ulInterfaceRefCount
;
}
/*
* Simple COM procedure. Decrease the reference count to this object.
* If the object no longer has any reference counts, free up the associated
* memory.
*/
static
ULONG
WINAPI
DPL_Release
(
IDirectPlayLobbyImpl
*
This
)
static
void
dplobby_destroy
(
IDirectPlayLobbyImpl
*
obj
)
{
ULONG
ulInterfaceRefCount
=
InterlockedDecrement
(
&
This
->
ulInterfaceRef
);
TRACE
(
"ref count decremented to %u for %p
\n
"
,
ulInterfaceRefCount
,
This
);
/* Deallocate if this is the last reference to the object */
if
(
ulInterfaceRefCount
==
0
)
{
DPL_DestroyLobby1
(
This
);
This
->
lock
.
DebugInfo
->
Spare
[
0
]
=
0
;
DeleteCriticalSection
(
&
This
->
lock
);
HeapFree
(
GetProcessHeap
(),
0
,
This
);
}
return
ulInterfaceRefCount
;
DPL_DestroyLobby1
(
obj
);
obj
->
lock
.
DebugInfo
->
Spare
[
0
]
=
0
;
DeleteCriticalSection
(
&
obj
->
lock
);
HeapFree
(
GetProcessHeap
(),
0
,
obj
);
}
static
HRESULT
WINAPI
IDirectPlayLobby3AImpl_QueryInterface
(
IDirectPlayLobby3A
*
iface
,
REFIID
riid
,
...
...
@@ -205,25 +178,53 @@ static HRESULT WINAPI IDirectPlayLobby3Impl_QueryInterface( IDirectPlayLobby3 *i
static
ULONG
WINAPI
IDirectPlayLobby3AImpl_AddRef
(
IDirectPlayLobby3A
*
iface
)
{
IDirectPlayLobbyImpl
*
This
=
impl_from_IDirectPlayLobby3A
(
iface
);
return
DPL_AddRef
(
This
);
ULONG
ref
=
InterlockedIncrement
(
&
This
->
ref3A
);
TRACE
(
"(%p) ref3A=%d
\n
"
,
This
,
ref
);
if
(
ref
==
1
)
InterlockedIncrement
(
&
This
->
numIfaces
);
return
ref
;
}
static
ULONG
WINAPI
IDirectPlayLobby3Impl_AddRef
(
IDirectPlayLobby3
*
iface
)
{
IDirectPlayLobbyImpl
*
This
=
impl_from_IDirectPlayLobby3
(
iface
);
return
DPL_AddRef
(
This
);
ULONG
ref
=
InterlockedIncrement
(
&
This
->
ref3
);
TRACE
(
"(%p) ref3=%d
\n
"
,
This
,
ref
);
if
(
ref
==
1
)
InterlockedIncrement
(
&
This
->
numIfaces
);
return
ref
;
}
static
ULONG
WINAPI
IDirectPlayLobby3AImpl_Release
(
IDirectPlayLobby3A
*
iface
)
{
IDirectPlayLobbyImpl
*
This
=
impl_from_IDirectPlayLobby3A
(
iface
);
return
DPL_Release
(
This
);
ULONG
ref
=
InterlockedDecrement
(
&
This
->
ref3A
);
TRACE
(
"(%p) ref3A=%d
\n
"
,
This
,
ref
);
if
(
!
ref
&&
!
InterlockedDecrement
(
&
This
->
numIfaces
)
)
dplobby_destroy
(
This
);
return
ref
;
}
static
ULONG
WINAPI
IDirectPlayLobby3Impl_Release
(
IDirectPlayLobby3
*
iface
)
{
IDirectPlayLobbyImpl
*
This
=
impl_from_IDirectPlayLobby3
(
iface
);
return
DPL_Release
(
This
);
ULONG
ref
=
InterlockedDecrement
(
&
This
->
ref3
);
TRACE
(
"(%p) ref3=%d
\n
"
,
This
,
ref
);
if
(
!
ref
&&
!
InterlockedDecrement
(
&
This
->
numIfaces
)
)
dplobby_destroy
(
This
);
return
ref
;
}
...
...
@@ -1520,7 +1521,9 @@ HRESULT dplobby_create( REFIID riid, void **ppv )
obj
->
IDirectPlayLobby3_iface
.
lpVtbl
=
&
dpl3_vt
;
obj
->
IDirectPlayLobby3A_iface
.
lpVtbl
=
&
dpl3A_vt
;
obj
->
ulInterfaceRef
=
1
;
obj
->
numIfaces
=
1
;
obj
->
ref3
=
1
;
obj
->
ref3A
=
0
;
InitializeCriticalSection
(
&
obj
->
lock
);
obj
->
lock
.
DebugInfo
->
Spare
[
0
]
=
(
DWORD_PTR
)(
__FILE__
": IDirectPlayLobbyImpl.lock"
);
...
...
dlls/dplayx/tests/dplayx.c
View file @
02e9c999
...
...
@@ -6487,7 +6487,7 @@ static void test_COM_dplobby(void)
hr
=
IDirectPlayLobby_QueryInterface
(
dpl
,
&
IID_IDirectPlayLobbyA
,
(
void
**
)
&
dplA
);
ok
(
hr
==
S_OK
,
"QueryInterface for IID_IDirectPlayLobbyA failed: %08x
\n
"
,
hr
);
refcount
=
IDirectPlayLobby_AddRef
(
dplA
);
todo_wine
ok
(
refcount
==
2
,
"refcount == %u, expected 2
\n
"
,
refcount
);
ok
(
refcount
==
2
,
"refcount == %u, expected 2
\n
"
,
refcount
);
IDirectPlayLobby_Release
(
dplA
);
hr
=
IDirectPlayLobby_QueryInterface
(
dpl
,
&
IID_IDirectPlayLobby2
,
(
void
**
)
&
dpl2
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment