[solved] Can't us GetDataLineStart and Move why ? lazarus / 31-LCL ---------------------------------------------------------------------- bubulemaster · 2011-11-26 13:03 Hi, I look about GetDataLineStart() and I would like use Move to copy fast a picture to another picture. All picture is TBitmap 24 bits per pixel color. When I use a code like below : Code: [Select]type   TRGBArray = array[word] of TRGBTriple ;   pRGBArray = ^TRGBArray ; procedure .... var     // Source image     lSrc : TLazIntfImage ;     // Destination image     lDst : TLazIntfImage ;     // Source line     lSrcLine : pRGBArray ;     // Destination line     lDstLine : pRGBArray ; begin        // PixelFormat := pf24bit         // For each line of source         for lLineIndex := 0 to lSrc.Height - 1 do         begin             lSrcLine := lSrc.GetDataLineStart(lLineIndex) ;             lDstLine := lDst.GetDataLineStart(lLineIndex) ;             Move(lSrcLine, lDstLine, lSrc.Width * 3) ; // * 3 -> for 24 bits         end ; end ; First time (lLineIndex  = 0) is ok, but the second time (lLineIndex = 1), I receive a SIGSEGV on first GetDataLineStart(). Ok, it doesn't work. But I just want understand why. It's two pointer on differents memories. Someone can explain me ? Thanks you. ---------------------------------------------------------------------- ludob · 2011-11-26 13:52 QuoteMove(lSrcLine, lDstLine, lSrc.Width * 3)This copies the contents of lSrcLine to lDstLine for lSrc.Width * 3 bytes. So you copy lSrcLine to lDstLine and overwrite a big chunk of the stack in doing so. What you want to do is to copy the memory pointed to by lSrcLine to the memory pointed to by lDstLine: Code: [Select]Move(lSrcLine^, lDstLine^, lSrc.Width * 3) ---------------------------------------------------------------------- bubulemaster · 2011-11-27 07:01 Ok, thank. I don't know where I saw the methode Move(pointer,pointer, integer). I read the source code of freepascal and I see Code: [Select]Procedure Move(const source;var dest;count:SizeInt); I'm so stupid sorry !