[Gambas-user] Weird Timer Problem

Benoit Minisini gambas at ...1...
Sun Jan 20 22:04:46 CET 2008


On dimanche 20 janvier 2008, Gareth Bult wrote:
> Ok, I finally managed to reproduce my problem in a code snippet.
> Essentially this is a new project, stock V2 gambas, with a blank form and
> one element, a timer called "killer".
>
> If I run the code, it works fine.
> If I insert the killer.stop and killer.start lines, the program crashes
> with a signal #11 after about 5 to 10 iterations.
>
> Help!
>
> ----
>
> ' Gambas class file
> PUBLIC EXTERN virConnectOpenReadOnly(host AS String) AS Pointer IN
> "libvirt" PUBLIC EXTERN virDomainLookupByID(con AS Pointer, id AS Integer)
> AS Pointer IN "libvirt" PUBLIC EXTERN virDomainGetInfo(dom AS Pointer, inf
> AS Pointer) AS Integer IN "libvirt"
>
> PUBLIC SUB killer_Timer()
>
> 'killer.Stop() 'Adding these lines causes Sig#11 after 5-10 iterations
> PRINT "Help me!"
> DoIt()
> 'killer.Start() 'Adding these lines causes Sig#11 after 5-1- iterations
>
> END
>
> PUBLIC SUB DoIt()
>
> DIM node AS Pointer
> DIM domain AS Pointer
> DIM info AS Pointer = Alloc(24)
>
> node = virConnectOpenReadOnly("xen+tls://nodeb/default")
> domain = virDomainLookupByID(node, 0)
> virDomainGetInfo(domain, info)
>
> END
>

No problem there. I think that the crash comes from DoIt() instead. 

Try to remove the call DoIt() and keep the calls to Killer.Stop() and 
Killer.Start(), and tell me if it crashes.

I don't know at all the extern functions you are calling, so I suggest that 
you run your project into valgrind to see when the memory is corrupted. To do 
that, open a terminal inside your project directory, and type:

$ valgrind --num-callers=80 gbx2 -p

Regards,

-- 
Benoit Minisini




More information about the User mailing list