Page 20 of 23

Re: PurePOP3 library : POP3 functions

Posted: Fri Jul 16, 2010 3:49 pm
by gnozal
rdority wrote:Well unfortunately my entire experience so far with PB has rested on the shoulders of PurePop3. My little app which I spent months on worked fairly well in Xp but now I can't even use it in Windows 7.
Windows Se7en 64 bits can run 32 bit apps.

Re: PurePOP3 library : POP3 functions

Posted: Fri Jul 16, 2010 3:59 pm
by rdority
It's true there is an Xp mode that can be applied on a task by task basis in Windows 7 however that didn't make the app start working again. So much for paying the extra cash for W7 professional. ;)

Re: PurePOP3 library : POP3 functions

Posted: Wed Nov 17, 2010 2:05 pm
by gnozal
Update (PB4.5x version)

- Fixed a bug with some multipart messages.

PurePOP3 crash

Posted: Thu Dec 30, 2010 10:00 pm
by C64
One of my apps crashed with an Illegal Operation error today, so I re-ran it with the purifier on and it says the FreeMemory() command in this snippet is using an invalid memory ID. Am I using the following snippet properly? If I delete the FreeMemory() command then my app runs fine and no crash happens, but I don't think that's a good idea to do.

Code: Select all

body$=""
html=PurePOP3_IsMessageHTML()
b=PurePOP3_GetMessageTextInMemory(html)
If b
  body$=PeekS(b)
  FreeMemory(b); Purifier hates this line.
EndIf

Re: PurePOP3 crash

Posted: Thu Dec 30, 2010 10:28 pm
by IdeasVacuum
Hi

This post should be on gnozal's section. The function requires a pointer to a string in memory, as per the example in the PurePop3 help, which also states that it must be used after a PurePOP3_RetrieveMessage() call:

Get text from retrieved message.
If HTML is #True, the retrieved text is "text/html" (default is "text/plain")

Must be used after PurePOP3_RetrieveMessage().

Returned values :
- > 0 : memory pointer to message text [ASCIIZ]
- 0 : error

Code: Select all

If PurePOP3_RetrieveMessage(MessageNumber.l) > 0
      *Message = PurePOP3_GetMessageTextInMemory()
      If *Message
        Debug "Message text : " + PeekS(*Message)
        FreeMemory(*Message)
      EndIf
EndIf



Re: PurePOP3 crash

Posted: Fri Dec 31, 2010 9:40 am
by C64
IdeasVacuum wrote:This post should be on gnozal's section
Sorry! Perhaps a forum moderator could move it for me, please.
IdeasVacuum wrote:The function requires a pointer to a string in memory, as per the example in the PurePop3 help, which also states that it must be used after a PurePOP3_RetrieveMessage() call
I didn't post my full code to save time, but the code sample I posted is just part of my source. I have already retrieved the message before the code is executed. My code shows that b<>0, which means the mail body HAS been read correctly, and indeed my program shows me the body correctly (stored in body$), but then trying to free it is causing a invalid memory access error. It shouldn't if the body has been read, correct?

Re: PurePOP3 crash

Posted: Fri Dec 31, 2010 10:08 am
by ts-soft
You have to remove FreeMemory, FreeMemory is only for allocated Memory with PB, not for
pointer to Strings.

Re: PurePOP3 crash

Posted: Fri Dec 31, 2010 10:57 am
by C64
ts-soft wrote:You have to remove FreeMemory, FreeMemory is only for allocated Memory with PB, not for
pointer to Strings.
But the help file says to use FreeMemory(), just as IdeasVacuum posted. How else can I free it?

Re: PurePOP3 crash

Posted: Fri Dec 31, 2010 10:58 am
by gnozal
ts-soft wrote:You have to remove FreeMemory, FreeMemory is only for allocated Memory with PB, not for
pointer to Strings.
PurePOP3_GetMessageTextInMemory() returns a pointer to allocated memory with AllocateMemory().

Now, although I never experienced a problem myself, maybe there is an issue because the memory is allocated in the library, and FreeMemory() is executed in the main code.
I may have to add a function to free the memory from the library.

Re: PurePOP3 library : POP3 functions

Posted: Fri Dec 31, 2010 11:04 am
by ts-soft
This problem comes with to small allocated memory! Your allocations miss the place for the nullbyte(s) for strings?

Code: Select all

Define.s Text = "Hello"

Define *mem = AllocateMemory(Len(Text)); to small!

PokeS(*mem, Text)

FreeMemory(*mem)

Test this with and without purifier :wink:

Re: PurePOP3 library : POP3 functions

Posted: Fri Dec 31, 2010 11:33 am
by gnozal
ts-soft wrote:This problem comes with to small allocated memory! Your allocations miss the place for the nullbyte(s) for strings?
The library code allocates extra space for the null bytes.
And the library does not trigger any error with the purifier.

Re: PurePOP3 library : POP3 functions

Posted: Fri Dec 31, 2010 11:36 am
by gnozal
I have updated the library (PB 4.50 version).

I have added a new function PurePOP3_FreeMessagePointer() to free the memory allocated by PurePOP3_GetMessageTextInMemory().

Code: Select all

If PurePOP3_RetrieveMessage(MessageNumber.l) > 0
         *Message = PurePOP3_GetMessageTextInMemory()
         If *Message
            Debug "Message text : " + PeekS(*Message)
            PurePOP3_FreeMessagePointer(*Message)
         EndIf
EndIf 
Please test.

Re: PurePOP3 library : POP3 functions

Posted: Fri Dec 31, 2010 1:14 pm
by C64
Thank you, no more crash when using PurePOP3_FreeMessagePointer() now. :D

PurePOP3_IsMessageHTML() hangs

Posted: Sat Jan 29, 2011 10:32 am
by C64
I've got an email with a 35 KB image attachment, and when I use the PurePOP3_IsMessageHTML() command, it just hangs. I know it hangs because the following code just prints "start" to the debug output window and never the "finish", and my program just sits there without continuing, even after 5 minutes. I can post the trace output if you like, but would rather not for privacy reasons. Maybe you can just look at the command first and see if something obvious was missed?

Code: Select all

Debug "start"
h=PurePOP3_IsMessageHTML()
Debug "finish"

Re: PurePOP3_IsMessageHTML() hangs

Posted: Sat Jan 29, 2011 10:47 am
by gnozal
C64 wrote:I've got an email with a 35 KB image attachment, and when I use the PurePOP3_IsMessageHTML() command, it just hangs. I know it hangs because the following code just prints "start" to the debug output window and never the "finish", and my program just sits there without continuing, even after 5 minutes. I can post the trace output if you like, but would rather not for privacy reasons. Maybe you can just look at the command first and see if something obvious was missed?
Without the traces, I can do zip.
There is nothing obvious with "multipart/related", "multipart/alternative", etc... ; every mail client sends the stuff differently.