[Gambas-user] [CRASH REPORT] CherchMail

Rolf-Werner Eilert rwe-sse at osnanet.de
Mon Mar 13 09:30:24 CET 2023


Am 11.03.23 um 20:10 schrieb Philippe Valarcher:
> Hello,
> 
> Damned, my program crashed Gambas that way :
> 
> Public Function RunPOP(i As Integer) As 
> String                                  'alimentation des comptes en mails
> 
>     Dim Ligne As Integer, n As Integer, Emails As Integer
>     Dim newLast As String, phrase1 As String, phrase2 As String, monText 
> As String
> 
>     Module1.serveurPop(i)
>     Try 
> Module1.POP.Open                                                       
> 'ouverture de la connexion pop
> 
>     Emails = Module1.POP.count
> 
>     If Emails > 0 Then
>        newLast = Module1.POP[Module1.POP.count - 1].UniqueID
>        If newLast > MailRecu[i].theLast Then
>           If chkBeep.value Then PlayBeep()
>        Endif
>        monText = 
> txtRun.Text                                                ' texte des 
> notifications
>        phrase1 = ("Serveur : ")
>        phrase2 = ("Nombre de Courriel(s) : ")
>        monText = Replace(monText, "%p1", phrase1)
>        monText = Replace(monText, "%p2", phrase2)
>        monText = Replace(monText, "%u", Module1.pop.user)
>        monText = Replace(monText, "%s", Module1.pop.host)
>        monText = Replace(monText, "%m", CStr(emails))
>        AddLog(("Nombre de courriels sur le serveur") & " : " & " [ " & 
> Module1.pop.host & " ] " & " : " & Emails)
> 
>        grvw[i].Rows.Count = Module1.POP.Count
> 
>        For n = 0 To Emails - 1
>           newLast = Module1.POP[n].UniqueID
>           tbstp[i + 1].Text = Accounts[i].Nom & " + " & Module1.POP.Count
>           ' grvw[i].Columns.Count = 5
> 
>           grvw[i][Ligne, 0].Text = CStr(Module1.POP[n].Message.Sender)
>           grvw[i][Ligne, 1].Text = CStr(Module1.POP[n].Message.Subject)
>           grvw[i][Ligne, 2].Text = CStr(Module1.POP[n].Message.To)
>           grvw[i][Ligne, 3].Text = 
> CStr(Module1.POP[n].Message.Headers["Date"])
>           grvw[i][Ligne, 4].Text = CStr(Module1.POP[n].Size)
> 
>           Ligne += 1
>           MailRecu[i].index = Module1.POP[n].Index
>           nbrMail += 1
>        Next
> 
>        MailRecu[i].theLast = Module1.POP[Emails - 1].UniqueID
>        grvw[i].Tooltip = ("Double-Cliquer sur un message pour le visionner")
> 
>     Else
>        tbstp[i + 1].Text = Accounts[i].Nom
>        With grvw[i]
>           .Clear
>           .Refresh
>           .Rows.Count = 0
>           .Columns.Count = 0
>           .Tooltip = ""
>        End With
>     Endif
> 
>     Try Module1.POP.Close
>     Try Module1.POP = Null
> 
>     Return monText
> 
> Catch
>     TimeRemain = TimeInterval
>     Tray.icon = Picture["./icônes/mail.png"]
>     Message.Title = ("Horreur!")
>     Message(gb.CrLf & ("Une erreur : ") & " RunPOP " & Error.Text & 
> gb.CrLf & "Code : " & Error.Code)
> 
> End
> 
> Public Sub tbstp_MouseDown()
> 
>     Module1.son(Module1.shade)
> 
> End
> Cette fontion provoque une erreur de segmentation, si je commente les 
> cinq lignes avec grvw[i] ça ne plante pas?


I tried to answer in French, but my English is better :)

What springs into my eye is this:

grvw[i].Tooltip = ("Double-Cliquer sur un message pour le visionner")

and this:

Message(gb.CrLf & ("Une erreur : ") & " RunPOP " & Error.Text &
 > gb.CrLf & "Code : " & Error.Code)

What do you use brackets for in connection with strings? I have never 
seen that before.

Second of all, is grvw a tableview? You spend a lot of effort in calling 
a bunch of its functions to clear, refresh, then set again and so on. 
Why not using the tableview's Data event and leave the whole work to the 
tableview?

I might be wrong here, but it looks as if the tableview expects to be 
"not empty/void", such things are easily overseen and have driven me 
nuts in the past. This is one point I would start looking for the error.

Regards
Rolf



More information about the User mailing list