Discussion:
Interface not supported
(too old to reply)
Louis Young
2003-11-17 10:56:43 UTC
Permalink
Hi all

Believe or not, I still haven't found an answer to this one.

Here's the code again:

procedure TfrmMain.buildPaymentPacket(Currency: String);

var

VagasFinancialRequest: IXMLVagasFinancialRequestType;

begin

FreeAndNil(VagasFinancialRequest);

VagasFinancialRequest := GetVagasFinancialRequest(dmData.xdTPPVagas);

VagasFinancialRequest.Currency := Trim(Currency);

end;

The first time when I call the procedure like this:

buildPaymentPacket('710');

It works like a charm.

The second time round, I get this error:

---------------------------

Debugger Exception Notification

---------------------------

Project TPPServer.exe raised exception class EIntfCastError with message
'Interface not supported'. Process stopped. Use Step or Run to continue.

---------------------------

OK Help

---------------------------

What exactly this error means, I'm not quite sure yet. Google could not shed
any light on the subject.

If anybody has any ideas, no matter how stupid you might think they sound,
throw them this way. I may or may not have thought of it before.

Thanks

Louis
Marcel Bestebroer
2003-11-17 11:03:34 UTC
Permalink
Hello, Louis!
You wrote on Mon, 17 Nov 2003 12:56:43 +0200:

LY> procedure TfrmMain.buildPaymentPacket(Currency: String);
LY> var
LY> VagasFinancialRequest: IXMLVagasFinancialRequestType;
LY> begin
LY> FreeAndNil(VagasFinancialRequest);

That is not needed (and maybe even wrong to do).
IXMLVegaFinancialRequestType seems to be an interface, which will get
released automatically (and is nilled automatically). If you do want to set
it to nil, never use FreeAndNil on an interface type; just set the variable
to nil using 'VegaFinancialRequest := nil'.

LY> VagasFinancialRequest := GetVagasFinancialRequest(dmData.xdTPPVagas);

LY> VagasFinancialRequest.Currency := Trim(Currency);

LY> end;

LY> Project TPPServer.exe raised exception class EIntfCastError with
LY> message 'Interface not supported'. Process stopped. Use Step or Run to
LY> continue.

This might be caused by the FreeAndNil call.


--
Marcel Bestebroer (Team JEDI) http://delphi-jedi.org
Project JEDI Help coordinator
JVCL Help team coordinator

To mail me, remove the obvious from my mail address

Foobar2000 now playing: "Aquarium" by Nits.

Loading...