[fpc-pascal] help with synapse mime routines...

waldo kitty wkitty42 at windstream.net
Thu Feb 17 15:39:32 CET 2011

On 2/16/2011 23:39, Kevin Jesshope wrote:
> Hi Waldo,
> I don't have the mimepart or synaser units available at the moment so
> without actually compiling the code I am not certain the following
> observations are the cause of your trouble. They are however somewhere
> to start.
> 1 In line 63 you are checking to see if m1 is nil to see if the object
> has already been freed. This will not work as Free does not set the
> var to nil. Use FreeAndNil(m1) instead to acheive that.

yes, that was a flailing attempt to try to bypass the free that apparently 
shouldn't be... i'll remove that... or, i think i see what you are saying... if 
i use freeandnil instead of the current m1.free, then the nil test might work 
and show me that the object is really already gone... i'll try that in addition 
to the below...

> 2 In line 49 you are assigning m1 := m.GetSubPart(MyPart - 1) so when
> you go to free m1, expecting to free the m1 created in line 44, you
> are in fact freeing the result from the GetSubPart function.

right... i'm thinking that m1 should contain only the indicated MIME part from 
m... ahhh! so what you are saying is that i do not need to explicitly create m1 
before assigning m.GetSubPart to it... hummm...

but then i have to wonder why it works the first time and not the second? the 
process does show the proper mime parts, one text/plain and the other 
text/html... i think i'll manually add a third part to the test message i'm 
processing and see if i still get the failure on the second one or if it then 
moves to the third one... i'll do this in addition to testing the above 

> You have lost the reference you had to the original TMimePart created
> at line 44. Declare and use say m2 to fix this one.

i think the above is one of the main clues... i'll try it out and see what 

> Regards
> Kevin Jesshope - In Touch Computer Support
>> can anyone assist with the reason for the exception?? i'm using the last
>> release code of synapse (download zip archive) with FPC 2.4.3... currently
>> on win32...
> _______________________________________________
> fpc-pascal maillist  -  fpc-pascal at lists.freepascal.org
> http://lists.freepascal.org/mailman/listinfo/fpc-pascal

More information about the fpc-pascal mailing list