Commit a27da35b authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

msctf: Moved thread manager's sink list destructor implementation into a more generic helper.

parent 0374ee29
......@@ -323,6 +323,15 @@ HRESULT unadvise_sink(DWORD cookie)
return S_OK;
}
void free_sinks(struct list *sink_list)
{
while(!list_empty(sink_list))
{
Sink* sink = LIST_ENTRY(sink_list->next, Sink, entry);
free_sink(sink);
}
}
/*****************************************************************************
* Active Text Service Management
*****************************************************************************/
......
......@@ -77,6 +77,7 @@ typedef struct {
HRESULT advise_sink(struct list *sink_list, REFIID riid, DWORD cookie_magic, IUnknown *unk, DWORD *cookie) DECLSPEC_HIDDEN;
HRESULT unadvise_sink(DWORD cookie) DECLSPEC_HIDDEN;
void free_sinks(struct list *sink_list) DECLSPEC_HIDDEN;
extern const WCHAR szwSystemTIPKey[] DECLSPEC_HIDDEN;
extern const WCHAR szwSystemCTFKey[] DECLSPEC_HIDDEN;
......
......@@ -157,12 +157,6 @@ static inline EnumTfDocumentMgr *impl_from_IEnumTfDocumentMgrs(IEnumTfDocumentMg
return CONTAINING_RECORD(iface, EnumTfDocumentMgr, IEnumTfDocumentMgrs_iface);
}
static void free_sink(Sink *sink)
{
IUnknown_Release(sink->interfaces.pIUnknown);
HeapFree(GetProcessHeap(),0,sink);
}
static void ThreadMgr_Destructor(ThreadMgr *This)
{
struct list *cursor, *cursor2;
......@@ -176,43 +170,12 @@ static void ThreadMgr_Destructor(ThreadMgr *This)
if (This->focus)
ITfDocumentMgr_Release(This->focus);
/* free sinks */
LIST_FOR_EACH_SAFE(cursor, cursor2, &This->ActiveLanguageProfileNotifySink)
{
Sink* sink = LIST_ENTRY(cursor,Sink,entry);
list_remove(cursor);
free_sink(sink);
}
LIST_FOR_EACH_SAFE(cursor, cursor2, &This->DisplayAttributeNotifySink)
{
Sink* sink = LIST_ENTRY(cursor,Sink,entry);
list_remove(cursor);
free_sink(sink);
}
LIST_FOR_EACH_SAFE(cursor, cursor2, &This->KeyTraceEventSink)
{
Sink* sink = LIST_ENTRY(cursor,Sink,entry);
list_remove(cursor);
free_sink(sink);
}
LIST_FOR_EACH_SAFE(cursor, cursor2, &This->PreservedKeyNotifySink)
{
Sink* sink = LIST_ENTRY(cursor,Sink,entry);
list_remove(cursor);
free_sink(sink);
}
LIST_FOR_EACH_SAFE(cursor, cursor2, &This->ThreadFocusSink)
{
Sink* sink = LIST_ENTRY(cursor,Sink,entry);
list_remove(cursor);
free_sink(sink);
}
LIST_FOR_EACH_SAFE(cursor, cursor2, &This->ThreadMgrEventSink)
{
Sink* sink = LIST_ENTRY(cursor,Sink,entry);
list_remove(cursor);
free_sink(sink);
}
free_sinks(&This->ActiveLanguageProfileNotifySink);
free_sinks(&This->DisplayAttributeNotifySink);
free_sinks(&This->KeyTraceEventSink);
free_sinks(&This->PreservedKeyNotifySink);
free_sinks(&This->ThreadFocusSink);
free_sinks(&This->ThreadMgrEventSink);
LIST_FOR_EACH_SAFE(cursor, cursor2, &This->CurrentPreservedKeys)
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment