Roy Shea : qmgr: Implement job lists for IBackgroundCopyManager.

Alexandre Julliard julliard at winehq.org
Fri Feb 29 06:16:57 CST 2008


Module: wine
Branch: master
Commit: c8a0e98b719cbb072a1ee8503761d8547dfca671
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=c8a0e98b719cbb072a1ee8503761d8547dfca671

Author: Roy Shea <roy at cs.hmc.edu>
Date:   Thu Feb 28 19:01:29 2008 -0800

qmgr: Implement job lists for IBackgroundCopyManager.

---

 dlls/qmgr/qmgr.c |   20 +++++++++++++++++++-
 dlls/qmgr/qmgr.h |    2 ++
 2 files changed, 21 insertions(+), 1 deletions(-)

diff --git a/dlls/qmgr/qmgr.c b/dlls/qmgr/qmgr.c
index c6f3db1..fdfd30c 100644
--- a/dlls/qmgr/qmgr.c
+++ b/dlls/qmgr/qmgr.c
@@ -26,7 +26,12 @@ WINE_DEFAULT_DEBUG_CHANNEL(qmgr);
 /* Destructor for instances of background copy manager */
 static void BackgroundCopyManagerDestructor(BackgroundCopyManagerImpl *This)
 {
+    BackgroundCopyJobImpl *job;
     TRACE("%p\n", This);
+
+    LIST_FOR_EACH_ENTRY(job, &This->jobs, BackgroundCopyJobImpl, entryFromQmgr)
+        job->lpVtbl->Release((IBackgroundCopyJob *) job);
+
     HeapFree(GetProcessHeap(), 0, This);
 }
 
@@ -91,9 +96,21 @@ static HRESULT WINAPI BITS_IBackgroundCopyManager_CreateJob(
         GUID *pJobId,
         IBackgroundCopyJob **ppJob)
 {
+    BackgroundCopyManagerImpl * This = (BackgroundCopyManagerImpl *) iface;
+    BackgroundCopyJobImpl *job;
+    HRESULT hres;
     TRACE("\n");
-    return BackgroundCopyJobConstructor(DisplayName, Type, pJobId,
+
+    hres = BackgroundCopyJobConstructor(DisplayName, Type, pJobId,
                                         (LPVOID *) ppJob);
+    if (FAILED(hres))
+        return hres;
+
+    /* Add a reference to the job to job list */
+    IBackgroundCopyJob_AddRef(*ppJob);
+    job = (BackgroundCopyJobImpl *) *ppJob;
+    list_add_head(&This->jobs, &job->entryFromQmgr);
+    return S_OK;
 }
 
 static HRESULT WINAPI BITS_IBackgroundCopyManager_GetJob(
@@ -151,6 +168,7 @@ HRESULT BackgroundCopyManagerConstructor(IUnknown *pUnkOuter, LPVOID *ppObj)
 
     This->lpVtbl = &BITS_IBackgroundCopyManager_Vtbl;
     This->ref = 1;
+    list_init(&This->jobs);
 
     *ppObj = &This->lpVtbl;
     return S_OK;
diff --git a/dlls/qmgr/qmgr.h b/dlls/qmgr/qmgr.h
index ddf9eee..f5629c6 100644
--- a/dlls/qmgr/qmgr.h
+++ b/dlls/qmgr/qmgr.h
@@ -40,6 +40,7 @@ typedef struct
     GUID jobId;
     struct list files;
     BG_JOB_PROGRESS jobProgress;
+    struct list entryFromQmgr;
 } BackgroundCopyJobImpl;
 
 /* Enum background copy jobs vtbl and related data */
@@ -74,6 +75,7 @@ typedef struct
 {
     const IBackgroundCopyManagerVtbl *lpVtbl;
     LONG ref;
+    struct list jobs;
 } BackgroundCopyManagerImpl;
 
 typedef struct




More information about the wine-cvs mailing list