[Gambas-user] error memory corruption: 0x08223b30

Benoit Minisini gambas at ...1...
Wed Oct 22 17:28:53 CEST 2008


On mercredi 22 octobre 2008, vitaf at ...1977... wrote:
>    Hello!
>
>   At performance of a mentioned below code there is an error:
>
>   *** glibc detected *** webcam1: malloc (): memory corruption:
> 0x08223b30 ***!
>
>   (OR error #11)
>
>   How it to correct, where I am mistaken?
>
>   File. Save ("/tmp/picrvka", sBuf)
>
>   Picture. Flush
>
>   PictureBox1.Picture = Picture. Load ("/tmp/picrvka")
>
>   PictureBox1.Refresh
>
>   All code is resulted more low.
>
>    ' Gambas class file
> PRIVATE hWebcam AS VideoDevice
> PRIVATE OnSet AS Boolean
> PRIVATE Fps AS Date
> PRIVATE nFps AS Integer
>
> PUBLIC SUB Form_Open()
>   TRY MKDIR (System.Home & "/.gambas-webcam")
> END
>
> PUBLIC SUB Button1_Click()
>
>   DIM num AS Integer
>   DIM Buf AS String
>
>   IF hWebCam THEN
>     Button1.Caption = ("Capture")
>     TxtDevice.Enabled = TRUE
>     hWebCam = NULL
>     Tmr.Enabled = FALSE
>     RETURN
>   END IF
>
>   TRY hWebCam = NEW VideoDevice(TxtDevice.Text)
>   IF ERROR THEN
>     Message.Error(("Unable to open video device"))
>     RETURN
>   END IF
>   hWebCam.Source = hWebCam.TV + hWebCam.PAL
>
>   Button1.Caption = ("Stop")
>   TxtDevice.Enabled = FALSE
>   OnSet = TRUE
>
>   WAIT 0.001
>   OnSet = FALSE
>   Tmr.Delay = 30
>   Tmr.Enabled = TRUE
>   ME.Caption = hWebCam.Features.Name
>   Fps = Now()
>   nFps = 0
>
> END
>
> PUBLIC SUB Tmr_Timer()
>
>   DIM T1 AS Date
>   DIM sBuf AS String
>
>   Tmr.Enabled = FALSE
>   TRY FLUSH #hWebCam
>   TRY READ #hWebCam, sBuf, Lof(hWebCam)
>   IF NOT ERROR THEN
>
> 'IF ERROR THEN
> '    Message.Error(("Тест пропуск"))
> '    RETURN
> 'END IF
>
> '2
>
> 'вариант 3
> File.Save("/tmp/picrvka", sBuf)
> Picture.Flush
> PictureBox1.Picture = Picture.Load("/tmp/picrvka")
> PictureBox1.Refresh
> 'KILL "/tmp/picrvka"
> 'конец вариант 3
>
> ' 4
>
>      nFps = nFps + 1
>     T1 = Now() - Fps
>     IF Second(T1) >= 1 THEN
>       ME.Caption = hWebCam.Features.Name & " (" & nFps & " fps)"
>       Fps = Now()
>       nFps = 0
>     END IF
>   END IF
>   Tmr.Enabled = TRUE
>
> END
>
> PUBLIC SUB Form_Close()
>
>   Tmr.Enabled = FALSE
>   hWebCam = NULL
>
> END
>
>   Vitaly.

Can you send your project as an archive? ("make source archive" menu in the 
IDE)

And please tell which version of Gambas you use.

Regards,

-- 
Benoit Minisini




More information about the User mailing list