Re: TidSMTP compent in a thread, in a package.

From: vertuas (vertuas_at_nospamcallistocs.freeserve.co.uk)
Date: 01/06/04


Date: Tue, 6 Jan 2004 12:32:28 -0000


"Rob Kennedy" <.> wrote in message news:vvkm0ak86qdt6c@corp.supernews.com...
> vertuas wrote:
> > Firstly, i do have FidSMTP:=TidSMTP.create(nil) my mistake when i typed
this
> > posting
>
> The moral: Don't type; copy & paste.

Thanks for that one, another lesson learned.

>
> > Here is my Constructor for my thread
> >
> > constructor TMailerThread.Create(CreateSuspended : boolean);
> > begin
> > inherited create(true);
> > FSettings:=tstringlist.create;
> > FSMTP := TidSMTP.Create(nil);
> >
> > with fsmtp do
> > begin
> > Host:='127.0.0.1';
> > Port:=25;
> > UserName:='vb';
> > end;
> > end;
>
> In a follow-up message, you indicated that there is a TIdMessage object,
> too. Don't you need to create that?
>

The message object IS createed and used in my execute procedure,

> > The statements indie the 'with' are just for basic set up with a local
> > freeware email server.
> >
> > If i comment out the line 'FSMTP:=TidSMTP.Create(nil) then i don't get
the
> > exception.
>
> If you don't create the component at all, then you don't get any
> exceptions? That's very strange.
>
> Again I ask: Where do you get the exception? Which line of code? Please
> post that code.
>

I get the error

Project1.exe has reaised exception class EAccessViolation with message '
Access violation at address 406E6E00 in module 'indy70.bpl'. Read of address
00000000' Process stopped. Use Step or Run to continue.

(Wish i could have copy/pasted that!)

The compiler jump to and highlights the line

FSMTP:=TidSMTP.Create(nil);

Removal of this lin gives

Access Violation at address 00D71D93 in module Mailer.bpl read off address
00000000

the compiler that jumps the the line

Host:='127.0.0.1';

which is underatandable as the TidSMTP wasn't created beecause creation the
line was removed.

> Is it possible that you're freeing FSMTP before you're finished using
> it? Or that you free it twice? Are you doing any pointer operations,
> such as using Move or TStream.Write?
>

Its Create in the Create constructor, it seams to be that the error is
occuring at create of the component

> The exception message for EAccessViolation provides two memory
> addresses. What are they? They can give a clue as to what kind of access
> violation you're experiencing.
>

Access violation at address 406E6E00 in module 'indy70.bpl'. Read of address
00000000

iisn't a read of address 00000000 usally associated with trying to uses
properties or methods of a component that failed to be create?

> > My applictaion IS set to use runtime packages, however I have not added
them
> > to the package list, as my packages, run and work most of the time.
Should
> > i hve added then ??
>
> Your plug-in package should *not* appear in your EXE's package list.
> (Otherwise, it wouldn't be a plug-in anymore.) The Indy package *should*
> appear in your plug-in's "requires" list. Indy should only appear in
> your EXE's package list if your EXE directly uses any of Indy's
facilities.

On this mailer plugin uses the function of the indy component, the main
application does use any network functions at all, that why the mailer
plugin is being written

>
> --
> Rob
I can't thank you enough for all you helping me, at the end of the day its
probaby something sill that i have missed, this is the project i have
worked of with runtime packages and plugins!

Kind regards

Vertuas



Relevant Pages

  • Re: DbC & Exceptions & Style
    ... exception. ... Different ways the constructor can fail ... to avoid writing code that converts GUI data into objects, ... All domain objects must now provide a default constructor. ...
    (comp.object)
  • Re: Controlled types and exception safety
    ... >> propagate an exception. ... >> For an Adjust invoked as part of an assignment operation, ... But a user-defined constructor is ... a user-defined constructor has just turned on the ...
    (comp.lang.ada)
  • Re: error wince600 boot message after dowload PB6 OS to HW board
    ... I would suspect that you have a memory layout problem, either the bootloader is using memory that is clobbering the downloaded image in some way, or the memory layout in the config.bib is wrong. ... Old or invalid version stamp in kernel structures - starting clean! ... Exception 'Access Violation': Thread-Id=00410002, ...
    (microsoft.public.windowsce.platbuilder)
  • Re: is such exception handling approach good?
    ... There is nothing wrong with throwing from constructor. ... It may be a good design, it may not be a good design from user's point ... resource API to free-up the resource on exception. ... change something - that is not initialization. ...
    (microsoft.public.vc.language)
  • Re: Question concerning object-oriented programming
    ... constructor the inspectof the state fails to verify key ... Better yet the constructor could throw an exception. ... opposed to stateless) object can know if it is in an invalid state. ...
    (comp.programming)