Aric Stewart : msctf: Contexts have a default DocumentMgr of the one that creates them.

Alexandre Julliard julliard at winehq.org
Wed Jun 17 10:43:23 CDT 2009


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

Author: Aric Stewart <aric at codeweavers.com>
Date:   Wed Jun 17 17:00:03 2009 +0900

msctf: Contexts have a default DocumentMgr of the one that creates them.

---

 dlls/msctf/context.c              |    3 ++-
 dlls/msctf/documentmgr.c          |    2 +-
 dlls/msctf/msctf_internal.h       |    2 +-
 dlls/msctf/tests/inputprocessor.c |   10 ++++++++++
 4 files changed, 14 insertions(+), 3 deletions(-)

diff --git a/dlls/msctf/context.c b/dlls/msctf/context.c
index 5eaffcf..e5cf602 100644
--- a/dlls/msctf/context.c
+++ b/dlls/msctf/context.c
@@ -709,7 +709,7 @@ static const ITfInsertAtSelectionVtbl Context_InsertAtSelectionVtbl =
     InsertAtSelection_InsertEmbeddedAtSelection,
 };
 
-HRESULT Context_Constructor(TfClientId tidOwner, IUnknown *punk, ITfContext **ppOut, TfEditCookie *pecTextStore)
+HRESULT Context_Constructor(TfClientId tidOwner, IUnknown *punk, ITfDocumentMgr *mgr, ITfContext **ppOut, TfEditCookie *pecTextStore)
 {
     Context *This;
     EditCookie *cookie;
@@ -733,6 +733,7 @@ HRESULT Context_Constructor(TfClientId tidOwner, IUnknown *punk, ITfContext **pp
     This->refCount = 1;
     This->tidOwner = tidOwner;
     This->connected = FALSE;
+    This->manager = mgr;
 
     CompartmentMgr_Constructor((IUnknown*)This, &IID_IUnknown, (IUnknown**)&This->CompartmentMgr);
 
diff --git a/dlls/msctf/documentmgr.c b/dlls/msctf/documentmgr.c
index 09cadb6..c7aa820 100644
--- a/dlls/msctf/documentmgr.c
+++ b/dlls/msctf/documentmgr.c
@@ -123,7 +123,7 @@ static HRESULT WINAPI DocumentMgr_CreateContext(ITfDocumentMgr *iface,
 {
     DocumentMgr *This = (DocumentMgr *)iface;
     TRACE("(%p) 0x%x 0x%x %p %p %p\n",This,tidOwner,dwFlags,punk,ppic,pecTextStore);
-    return Context_Constructor(tidOwner, punk, ppic, pecTextStore);
+    return Context_Constructor(tidOwner, punk, iface, ppic, pecTextStore);
 }
 
 static HRESULT WINAPI DocumentMgr_Push(ITfDocumentMgr *iface, ITfContext *pic)
diff --git a/dlls/msctf/msctf_internal.h b/dlls/msctf/msctf_internal.h
index 3b959be..d2b1a2e 100644
--- a/dlls/msctf/msctf_internal.h
+++ b/dlls/msctf/msctf_internal.h
@@ -33,7 +33,7 @@ extern ITfCompartmentMgr *globalCompartmentMgr;
 
 extern HRESULT ThreadMgr_Constructor(IUnknown *pUnkOuter, IUnknown **ppOut);
 extern HRESULT DocumentMgr_Constructor(ITfThreadMgrEventSink*, ITfDocumentMgr **ppOut);
-extern HRESULT Context_Constructor(TfClientId tidOwner, IUnknown *punk, ITfContext **ppOut, TfEditCookie *pecTextStore);
+extern HRESULT Context_Constructor(TfClientId tidOwner, IUnknown *punk, ITfDocumentMgr *mgr, ITfContext **ppOut, TfEditCookie *pecTextStore);
 extern HRESULT InputProcessorProfiles_Constructor(IUnknown *pUnkOuter, IUnknown **ppOut);
 extern HRESULT CategoryMgr_Constructor(IUnknown *pUnkOuter, IUnknown **ppOut);
 extern HRESULT Range_Constructor(ITfContext *context, ITextStoreACP *textstore, DWORD lockType, DWORD anchorStart, DWORD anchorEnd, ITfRange **ppOut);
diff --git a/dlls/msctf/tests/inputprocessor.c b/dlls/msctf/tests/inputprocessor.c
index 90d6989..67d53c6 100644
--- a/dlls/msctf/tests/inputprocessor.c
+++ b/dlls/msctf/tests/inputprocessor.c
@@ -1146,6 +1146,11 @@ static void test_startSession(void)
     hr = ITfDocumentMgr_CreateContext(g_dm, cid, 0, NULL, &cxt3, &editCookie);
     ok(SUCCEEDED(hr),"CreateContext Failed\n");
 
+    hr = ITfContext_GetDocumentMgr(cxt,&dmtest);
+    ok(hr == S_OK, "ITfContext_GetDocumentMgr failed with %x\n",hr);
+    ok(dmtest == g_dm, "Wrong documentmgr\n");
+    ITfDocumentMgr_Release(dmtest);
+
     cnt = check_context_refcount(cxt);
     test_OnPushContext = SINK_EXPECTED;
     test_ACP_AdviseSink = SINK_EXPECTED;
@@ -1215,6 +1220,11 @@ static void test_startSession(void)
     ok(check_context_refcount(cxt2) < cnt, "Ref count did not decrease\n");
     ok(test_OnPopContext == SINK_FIRED, "OnPopContext sink not fired\n");
 
+    dmtest = (void *)0xfeedface;
+    hr = ITfContext_GetDocumentMgr(cxt2,&dmtest);
+    ok(hr == S_FALSE, "ITfContext_GetDocumentMgr wrong rc %x\n",hr);
+    ok(dmtest == NULL,"returned documentmgr should be null\n");
+
     hr = ITfDocumentMgr_GetTop(g_dm, &cxtTest);
     ok(SUCCEEDED(hr),"GetTop Failed\n");
     ok(cxtTest == cxt, "Wrong context on top\n");




More information about the wine-cvs mailing list