I am always getting this alert when I am iterating through the
projects in a solution. It occurs when this is executed:
cpp_projects->Item(num, ¤t_project)
cpp_projects is of type CComPtr<EnvDTE::Projects>.
Does one have to call the following functions all in one function?
cpp_solution->get_Projects(&cpp_projects);
cpp_projects->get_Count(&project_count);
cpp_projects->Item(num, ¤t_project);
Currently I have each function call in separate functions.
I am using VS .NET 2003 on WinXP SP2.
Mikhail Arkhipov (Microsoft) - 07 Mar 2005 15:16 GMT
You are probably leaking a project item interface. Each time you call Item()
it expects current_project to be NULL (i.e. Released). You have to manually
release the interface even if it is a smart pointer since it is probably
declared outside of the loop.
CComPtr<EnvDTE::Projects> cpp_projects;
CComPtr<Project> current_project;
...
for(int i = 0 ; i < project_count; i++)
{
cpp_projects->Item(¤t_project);
...
current_project.Release();
}
OR declare pointer inside the loop instead (then you don't have to release
it).
for(i = 0 ; i < project_count; i++)
{
CComPtr<Project> current_project;
...
}
Thanks
Mikhail Arkhipov (Microsoft)
-- This post is provided 'AS IS' with no warranties and confers no rights
On 3/7/05 2:27, in article
1110191253.598204.74650@l41g2000cwc.googlegroups.com, "Frankie"
<franzaklein@yahoo.co.uk> wrote:
> I am always getting this alert when I am iterating through the
> projects in a solution. It occurs when this is executed:
[quoted text clipped - 8 lines]
>
> I am using VS .NET 2003 on WinXP SP2.