[gme-users] GME Crash, custom decorator.

Stefan Marte stefanmarte at yahoo.de
Mon Aug 23 20:00:38 CDT 2004


I am probably getting annoying, but I have one last problem in my
decorator, which again stems from my inexperience with COM.

I am using the following code to create a new IMgaFCOs collection,
and add all children of the model. this seems to work fine at first,
but after returning to GME, a crash follows. What am I missing?
(The code is from the decorator kit, I added the try block and
everything inside). I assume I mess up the smart pointers somewhere,
but I don't get why. It works btw, when I remove the coll->Append(...)
call.

--- code follows ---

	CComPtr<IMgaFCOs> coll;
	COMTHROW(coll.CoCreateInstance(OLESTR("Mga.MgaFCOs")));
        try {
		CComQIPtr<IMgaModel> model(self->FCO());
		CComPtr<IMgaFCOs> children;
		long iter;
		long ccount;
		int retval;

		retval = model->get_ChildFCOs(&children);
		retval = children->get_Count(&ccount);
		for (iter = 1; iter <= ccount; iter++) {
			CComPtr<IMgaFCO> child;
			retval = children->get_Item(iter,&child);
			retval = coll->Append(child);
		};
        } catch (...){};
	*portFCOs = coll.Detach();		


	
		
___________________________________________________________
Gesendet von Yahoo! Mail - Jetzt mit 100MB Speicher kostenlos - Hier anmelden: http://mail.yahoo.de


More information about the gme-users mailing list