Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
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-cw
Commits
989f39ef
Commit
989f39ef
authored
Aug 02, 2011
by
Michael Stefaniuc
Committed by
Alexandre Julliard
Aug 02, 2011
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dmloader: Simplify the module refcount handling.
parent
98a36f46
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
18 additions
and
28 deletions
+18
-28
container.c
dlls/dmloader/container.c
+3
-6
dmloader_main.c
dlls/dmloader/dmloader_main.c
+8
-13
dmloader_private.h
dlls/dmloader/dmloader_private.h
+3
-2
loader.c
dlls/dmloader/loader.c
+4
-7
No files found.
dlls/dmloader/container.c
View file @
989f39ef
...
...
@@ -68,9 +68,7 @@ static HRESULT DMUSIC_DestroyDirectMusicContainerImpl (LPDIRECTMUSICCONTAINER if
IStream_Release
(
This
->
pStream
);
/* FIXME: release allocated entries */
/* decrease number of instances */
InterlockedDecrement
(
&
dwDirectMusicContainer
);
unlock_module
();
return
S_OK
;
}
...
...
@@ -924,8 +922,7 @@ HRESULT WINAPI DMUSIC_CreateDirectMusicContainerImpl (LPCGUID lpcGUID, LPVOID* p
obj
->
pContainedObjects
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
sizeof
(
struct
list
));
list_init
(
obj
->
pContainedObjects
);
/* increase number of instances */
InterlockedIncrement
(
&
dwDirectMusicContainer
);
lock_module
();
return
IDirectMusicContainerImpl_IDirectMusicContainer_QueryInterface
((
LPDIRECTMUSICCONTAINER
)
&
obj
->
ContainerVtbl
,
lpcGUID
,
ppobj
);
}
dlls/dmloader/dmloader_main.c
View file @
989f39ef
...
...
@@ -23,8 +23,7 @@
WINE_DEFAULT_DEBUG_CHANNEL
(
dmloader
);
static
HINSTANCE
instance
;
LONG
dwDirectMusicContainer
=
0
;
LONG
dwDirectMusicLoader
=
0
;
LONG
module_ref
=
0
;
typedef
struct
{
IClassFactory
IClassFactory_iface
;
...
...
@@ -61,14 +60,14 @@ static HRESULT WINAPI ClassFactory_QueryInterface(IClassFactory *iface, REFIID r
static
ULONG
WINAPI
ClassFactory_AddRef
(
IClassFactory
*
iface
)
{
InterlockedIncrement
(
&
dwDirectMusicLoader
);
lock_module
(
);
return
2
;
/* non-heap based object */
}
static
ULONG
WINAPI
ClassFactory_Release
(
IClassFactory
*
iface
)
{
InterlockedDecrement
(
&
dwDirectMusicLoader
);
unlock_module
(
);
return
1
;
/* non-heap based object */
}
...
...
@@ -88,9 +87,9 @@ static HRESULT WINAPI ClassFactory_LockServer(IClassFactory *iface, BOOL dolock)
TRACE
(
"(%d)
\n
"
,
dolock
);
if
(
dolock
)
InterlockedIncrement
(
&
dwDirectMusicLoader
);
lock_module
(
);
else
InterlockedDecrement
(
&
dwDirectMusicLoader
);
unlock_module
(
);
return
S_OK
;
}
...
...
@@ -127,14 +126,10 @@ BOOL WINAPI DllMain (HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) {
*/
HRESULT
WINAPI
DllCanUnloadNow
(
void
)
{
TRACE
(
"(void)
\n
"
);
/* if there are no instances left, it's safe to release */
if
(
!
dwDirectMusicContainer
&&
!
dwDirectMusicLoader
)
return
S_OK
;
else
return
S_FALSE
;
}
TRACE
(
"() ref=%d
\n
"
,
module_ref
);
return
module_ref
?
S_FALSE
:
S_OK
;
}
/******************************************************************
* DllGetClassObject (DMLOADER.@)
...
...
dlls/dmloader/dmloader_private.h
View file @
989f39ef
...
...
@@ -45,8 +45,9 @@
#define ICOM_THIS_MULTI(impl,field,iface) impl* const This=(impl*)((char*)(iface) - offsetof(impl,field))
/* dmloader.dll global (for DllCanUnloadNow) */
extern
LONG
dwDirectMusicLoader
DECLSPEC_HIDDEN
;
/* number of DirectMusicLoader(CF) instances */
extern
LONG
dwDirectMusicContainer
DECLSPEC_HIDDEN
;
/* number of DirectMusicContainer(CF) instances */
extern
LONG
module_ref
DECLSPEC_HIDDEN
;
static
inline
void
lock_module
(
void
)
{
InterlockedIncrement
(
&
module_ref
);
}
static
inline
void
unlock_module
(
void
)
{
InterlockedDecrement
(
&
module_ref
);
}
/*****************************************************************************
* Interfaces
...
...
dlls/dmloader/loader.c
View file @
989f39ef
...
...
@@ -104,11 +104,9 @@ static ULONG WINAPI IDirectMusicLoaderImpl_IDirectMusicLoader_Release (LPDIRECTM
/*This->CritSect.DebugInfo->Spare[0] = 0;
DeleteCriticalSection (&This->CritSect); */
HeapFree
(
GetProcessHeap
(),
0
,
This
);
/* decrease number of instances */
InterlockedDecrement
(
&
dwDirectMusicLoader
);
unlock_module
();
}
return
dwRef
;
}
...
...
@@ -895,9 +893,8 @@ HRESULT WINAPI DMUSIC_CreateDirectMusicLoaderImpl (LPCGUID lpcGUID, LPVOID *ppob
pDefaultDLSEntry
->
bInvalidDefaultDLS
=
TRUE
;
}
/* increase number of instances */
InterlockedIncrement
(
&
dwDirectMusicLoader
);
lock_module
();
return
IDirectMusicLoaderImpl_IDirectMusicLoader_QueryInterface
((
LPDIRECTMUSICLOADER8
)
obj
,
lpcGUID
,
ppobj
);
}
...
...
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