void CSampleIME::_TerminateComposition(TfEditCookie ec, _In_ ITfContext *pContext, BOOL isCalledFromDeactivate) { isCalledFromDeactivate; if (_pComposition != nullptr) { // remove the display attribute from the composition range. _ClearCompositionDisplayAttributes(ec, pContext); if (FAILED(_pComposition->EndComposition(ec))) { // if we fail to EndComposition, then we need to close the reverse reading window. _DeleteCandidateList(TRUE, pContext); } _pComposition->Release(); _pComposition = nullptr; if (_pContext) { _pContext->Release(); _pContext = nullptr; } } }
STDAPI CMarkTextService::OnCompositionTerminated(TfEditCookie ecWrite, ITfComposition *pComposition) { // we already have the composition cached, so we can ignore pComposition... // all this service wants to do is clear the display property _ClearCompositionDisplayAttributes(ecWrite); // releae our cached composition SafeReleaseClear(_pComposition); return S_OK; }
void CTextService::_TerminateComposition(TfEditCookie ec, ITfContext *pContext) { if (_pComposition != NULL) { // remove the display attribute from the composition range. _ClearCompositionDisplayAttributes(ec, pContext); _pComposition->EndComposition(ec); _pComposition->Release(); _pComposition = NULL; CandidateTree->ToRoot(); } }