msctf: Contexts have a default DocumentMgr of the one that creates them.
This commit is contained in:
parent
2e52edf38d
commit
ca9ca58c20
|
@ -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);
|
||||
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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");
|
||||
|
|
Loading…
Reference in New Issue