Commit 9c6e7dea authored by Dmitry Timoshkov's avatar Dmitry Timoshkov Committed by Alexandre Julliard

taskschd: Delay creation of ITaskSettings until it's required.

parent 7d95758e
...@@ -966,11 +966,18 @@ static HRESULT WINAPI TaskDefinition_put_Triggers(ITaskDefinition *iface, ITrigg ...@@ -966,11 +966,18 @@ static HRESULT WINAPI TaskDefinition_put_Triggers(ITaskDefinition *iface, ITrigg
static HRESULT WINAPI TaskDefinition_get_Settings(ITaskDefinition *iface, ITaskSettings **settings) static HRESULT WINAPI TaskDefinition_get_Settings(ITaskDefinition *iface, ITaskSettings **settings)
{ {
TaskDefinition *taskdef = impl_from_ITaskDefinition(iface); TaskDefinition *taskdef = impl_from_ITaskDefinition(iface);
HRESULT hr;
TRACE("%p,%p\n", iface, settings); TRACE("%p,%p\n", iface, settings);
if (!settings) return E_POINTER; if (!settings) return E_POINTER;
if (!taskdef->taskset)
{
hr = TaskSettings_create(&taskdef->taskset);
if (hr != S_OK) return hr;
}
ITaskSettings_AddRef(taskdef->taskset); ITaskSettings_AddRef(taskdef->taskset);
*settings = taskdef->taskset; *settings = taskdef->taskset;
...@@ -985,7 +992,8 @@ static HRESULT WINAPI TaskDefinition_put_Settings(ITaskDefinition *iface, ITaskS ...@@ -985,7 +992,8 @@ static HRESULT WINAPI TaskDefinition_put_Settings(ITaskDefinition *iface, ITaskS
if (!settings) return E_POINTER; if (!settings) return E_POINTER;
ITaskSettings_Release(taskdef->taskset); if (taskdef->taskset)
ITaskSettings_Release(taskdef->taskset);
ITaskSettings_AddRef(settings); ITaskSettings_AddRef(settings);
taskdef->taskset = settings; taskdef->taskset = settings;
...@@ -1524,7 +1532,6 @@ static const ITaskDefinitionVtbl TaskDefinition_vtbl = ...@@ -1524,7 +1532,6 @@ static const ITaskDefinitionVtbl TaskDefinition_vtbl =
HRESULT TaskDefinition_create(ITaskDefinition **obj) HRESULT TaskDefinition_create(ITaskDefinition **obj)
{ {
HRESULT hr;
TaskDefinition *taskdef; TaskDefinition *taskdef;
taskdef = heap_alloc_zero(sizeof(*taskdef)); taskdef = heap_alloc_zero(sizeof(*taskdef));
...@@ -1532,13 +1539,6 @@ HRESULT TaskDefinition_create(ITaskDefinition **obj) ...@@ -1532,13 +1539,6 @@ HRESULT TaskDefinition_create(ITaskDefinition **obj)
taskdef->ITaskDefinition_iface.lpVtbl = &TaskDefinition_vtbl; taskdef->ITaskDefinition_iface.lpVtbl = &TaskDefinition_vtbl;
taskdef->ref = 1; taskdef->ref = 1;
hr = TaskSettings_create(&taskdef->taskset);
if (hr != S_OK)
{
ITaskDefinition_Release(&taskdef->ITaskDefinition_iface);
return hr;
}
*obj = &taskdef->ITaskDefinition_iface; *obj = &taskdef->ITaskDefinition_iface;
TRACE("created %p\n", *obj); TRACE("created %p\n", *obj);
......
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