[lazarus] Access Violation compiling Lazarus / LCL

2007-02-20 Thread tanila
Hello All,

since the last two days I can't compile the LCL (gtk) any more.
Compilation stops here:

Compiling ldockctrl.pas
Compiling ldockctrledit.pas
Compiling lclmessageglue.pas
Fatal: Compilation aborted
An unhandled exception occurred at $00596D6C :
EAccessViolation : Access violation
  $00596D6C
  $004F54DF
  $005062B0
  $004F54DF
  $00421604
  $00400412

make[1]: *** [alllclunits.ppu] Fehler 217
make[1]: Leaving directory `/home/tanila/lazarus/lcl'
make: *** [lcl] Fehler 2


Can somebody give me a hand ?

I hope it is not a problem wit my AMD64 again. 
OS is Debian/Etch. FPC and Lazarus are the actual SVN-Versions.
I thought to switch back to my old i386 machine. Does anyone has similar
compilation Problems ?

greetings
tanila


_
 To unsubscribe: mail [EMAIL PROTECTED] with
unsubscribe as the Subject
   archives at http://www.lazarus.freepascal.org/mailarchives


[lazarus] Access violation ?

2006-01-28 Thread A.J. Venter
Hi all,
I am trying to build a native gzip uncompressor into a unit for use by 
programs, no difficulty right, I just use paszlib and stole (with some 
adaptation) the code from the minigzip example to come up with this function 
(I chose a function in order to feed the output back to a graphical programs)

Trouble is, as soon as I try to use it, the program gets an access violation. 
In the terminal I can pick up the following output:

TApplication.HandleException Access violation
  Stack trace:
  $4048B4C0  LAZARUSPACKAGEINTF_finalize,  line 49 of gtkglobals.ppiphtml.pas
--
It doesn't actually matter WHICH packages are required, if I comment out the 
functions in the same unit that use iphtml and remove the requirements it 
still happens. If I remove the file from the package and try compiling a test 
program with the unit just in the same directory, it still fails. 
All that changes is the unit in WHICH it dies (seems to fall back to plain 
gtkglobals if iphtml is not present).

I assume the mostly plain pascal code this was based on is somehow not 
lazarus/package compatible but I am at a loss to explain why.

Any advice greatly appreciated, the function follows below

-
function gz_uncompress(inputfile,outputfile :string):Integer;
Var len:Int;
Written:Uint;
ioerr  :Integer;
err:int;
Busy   :Boolean;
Status :Integer;
infile :gzfile;
outfile:file;
Begin
infile := gzopen(inputfile,'r');
Assign(OutFile,OutputFile);
Rewrite(OutFile,1);
Status := 0;
Busy := True;
writeln('test');
  While Busy do begin

 len := gzread(infile, @buf, BUFLEN);
 if (len  0) then
   Begin
 Busy := False;
 Status :=  GzReadError;
   end;
 if len = 0 then
 Busy :=  False;

if busy then
Begin
{$I-}
 blockwrite (outfile,buf,len,written);
{$I+}
  if (written  len) then
   Begin
Busy := False;
Status := WriteError;
   end;
 end;
  end; {While}

If Status = 0 then
begin
 {$I-}
  close(OutFile);
 {$I+}
   ioerr := IOResult;
if ioerr  0 then
  Status := IOResult;

  if Status = 0 then
   if gzclose(infile)  0 then
 Status := GzCloseError;
end;
  gz_uncompress := Status;
end;

---
-- 
A.J. Venter
Chief Software Architext
OpenLab International
www.getopenlab.com
www.silentcoder.co.za
+27 82 726 5103

_
 To unsubscribe: mail [EMAIL PROTECTED] with
unsubscribe as the Subject
   archives at http://www.lazarus.freepascal.org/mailarchives


Re: [lazarus] Access violation ?

2006-01-28 Thread A.J. Venter
Another note on this, I stripped the function into a unit all of it's own (no 
package), then I called this  function from a lazarus program and got an 
access violation as soon as I called gz_uncompress.

I then created a very simple little plain pascal program calling the same unit 
with paramstr(1)'s - worked perfectly with no errors.

E.G. Whatever is wrong is indeed something in the pascal code clashing with 
something in the Object Pascal of lazarus - any ideas ?

A.J.
On Saturday 28 January 2006 15:01, A.J. Venter wrote:
 Hi all,
 I am trying to build a native gzip uncompressor into a unit for use by
 programs, no difficulty right, I just use paszlib and stole (with some
 adaptation) the code from the minigzip example to come up with this
 function (I chose a function in order to feed the output back to a
 graphical programs)

 Trouble is, as soon as I try to use it, the program gets an access
 violation. In the terminal I can pick up the following output:
 
 TApplication.HandleException Access violation
   Stack trace:
   $4048B4C0  LAZARUSPACKAGEINTF_finalize,  line 49 of
 gtkglobals.ppiphtml.pas --
 It doesn't actually matter WHICH packages are required, if I comment out
 the functions in the same unit that use iphtml and remove the requirements
 it still happens. If I remove the file from the package and try compiling a
 test program with the unit just in the same directory, it still fails.
 All that changes is the unit in WHICH it dies (seems to fall back to plain
 gtkglobals if iphtml is not present).

 I assume the mostly plain pascal code this was based on is somehow not
 lazarus/package compatible but I am at a loss to explain why.

 Any advice greatly appreciated, the function follows below

 -
 function gz_uncompress(inputfile,outputfile :string):Integer;
 Var len:Int;
 Written:Uint;
 ioerr  :Integer;
 err:int;
 Busy   :Boolean;
 Status :Integer;
 infile :gzfile;
 outfile:file;
 Begin
 infile := gzopen(inputfile,'r');
 Assign(OutFile,OutputFile);
 Rewrite(OutFile,1);
 Status := 0;
 Busy := True;
 writeln('test');
   While Busy do begin

  len := gzread(infile, @buf, BUFLEN);
  if (len  0) then
Begin
  Busy := False;
  Status :=  GzReadError;
end;
  if len = 0 then
  Busy :=  False;

 if busy then
 Begin
 {$I-}
  blockwrite (outfile,buf,len,written);
 {$I+}
   if (written  len) then
Begin
 Busy := False;
 Status := WriteError;
end;
  end;
   end; {While}

 If Status = 0 then
 begin
  {$I-}
   close(OutFile);
  {$I+}
ioerr := IOResult;
 if ioerr  0 then
   Status := IOResult;

   if Status = 0 then
if gzclose(infile)  0 then
  Status := GzCloseError;
 end;
   gz_uncompress := Status;
 end;

 ---

-- 
A.J. Venter
Chief Software Architext
OpenLab International
www.getopenlab.com
www.silentcoder.co.za
+27 82 726 5103

_
 To unsubscribe: mail [EMAIL PROTECTED] with
unsubscribe as the Subject
   archives at http://www.lazarus.freepascal.org/mailarchives


Re: [lazarus] Access violation ?

2006-01-28 Thread Mattias Gaertner
On Sat, 28 Jan 2006 15:01:41 +0200
A.J. Venter [EMAIL PROTECTED] wrote:

 Hi all,
 I am trying to build a native gzip uncompressor into a unit for use by 
 programs, no difficulty right, I just use paszlib and stole (with some 
 adaptation) the code from the minigzip example to come up with this
 function  (I chose a function in order to feed the output back to a
 graphical programs)
 
 Trouble is, as soon as I try to use it, the program gets an access
 violation.  In the terminal I can pick up the following output:
 
 TApplication.HandleException Access violation
   Stack trace:
$4048B4C0  LAZARUSPACKAGEINTF_finalize,  line 49 of gtkglobals.ppiphtml.pas

When you see the nonsense filename in the backtrace, you can be almost
certain, that the backtrace is garbish.
Probably an error occured earlier, which was not handled correct.


 --
 It doesn't actually matter WHICH packages are required, if I comment out
 the  functions in the same unit that use iphtml and remove the
 requirements it  still happens. If I remove the file from the package and
 try compiling a test  program with the unit just in the same directory, it
 still fails.  All that changes is the unit in WHICH it dies (seems to fall
 back to plain  gtkglobals if iphtml is not present).
 
 I assume the mostly plain pascal code this was based on is somehow not 
 lazarus/package compatible but I am at a loss to explain why.
 
 Any advice greatly appreciated, the function follows below
 
 -
 function gz_uncompress(inputfile,outputfile :string):Integer;
 Var len:Int;
 Written:Uint;
 ioerr  :Integer;
 err:int;
 Busy   :Boolean;
 Status :Integer;
 infile :gzfile;
 outfile:file;
 Begin
 infile := gzopen(inputfile,'r');

Test if infilenil.



Mattias



 Assign(OutFile,OutputFile);
 Rewrite(OutFile,1);
 Status := 0;
 Busy := True;
 writeln('test');
   While Busy do begin
 
  len := gzread(infile, @buf, BUFLEN);
  if (len  0) then
Begin
  Busy := False;
  Status :=  GzReadError;
end;
  if len = 0 then
  Busy :=  False;
 
 if busy then
 Begin
 {$I-}
  blockwrite (outfile,buf,len,written);
 {$I+}
   if (written  len) then
Begin
 Busy := False;
 Status := WriteError;
end;
  end;
   end; {While}
 
 If Status = 0 then
 begin
  {$I-}
   close(OutFile);
  {$I+}
ioerr := IOResult;
 if ioerr  0 then
   Status := IOResult;
 
   if Status = 0 then
if gzclose(infile)  0 then
  Status := GzCloseError;
 end;
   gz_uncompress := Status;
 end;
 
 ---

_
 To unsubscribe: mail [EMAIL PROTECTED] with
unsubscribe as the Subject
   archives at http://www.lazarus.freepascal.org/mailarchives


Re: [lazarus] Access violation

2005-12-08 Thread Michael Van Canneyt


On Thu, 8 Dec 2005, Arí Ricardo Ody wrote:

 Why the attached program issues access violation in the call of procedure
 LoadDirFiles?
 
 I try to remove the TStringList parameter and the violation persists...
 
 May someone give me an explanation?

You must create the stringlist first, before you can use it:

  Writeln ('1');
  xxx:=Ttringlist.Create;
  Try
LoadDirFiles (NomeDir,xxx,x);
Writeln ('2');
if not x then
   begin;
 Writeln ('Erro na chamada');
 Halt;
   end;
  finally  
xxx.free;
  end

And free it at the end.

That should do it.

Also, change your FIndFirst call so it actually uses the directory name:

  FileHandle := FindFirst (Dirname+'*.*',faAnyFile,Dir);
 

Michael.

Re: [lazarus] Access violation

2005-12-08 Thread Arí Ricardo Ody

Done! Thank you!



At 14:53 8/12/2005, you wrote:



On Thu, 8 Dec 2005, Arí Ricardo Ody wrote:

 Why the attached program issues access violation in the call of procedure
 LoadDirFiles?

 I try to remove the TStringList parameter and the violation persists...

 May someone give me an explanation?

You must create the stringlist first, before you can use it:

  Writeln ('1');
  xxx:=Ttringlist.Create;
  Try
LoadDirFiles (NomeDir,xxx,x);
Writeln ('2');
if not x then
   begin;
 Writeln ('Erro na chamada');
 Halt;
   end;
  finally
xxx.free;
  end

And free it at the end.

That should do it.

Also, change your FIndFirst call so it actually uses the directory name:

  FileHandle := FindFirst (Dirname+'*.*',faAnyFile,Dir);


Michael.


_
To unsubscribe: mail [EMAIL PROTECTED] with
   unsubscribe as the Subject
  archives at http://www.lazarus.freepascal.org/mailarchives


[lazarus] Access violation when accessing pixel data

2005-12-05 Thread Ger Remmers
Hi all,

When trying to read the pixel data in an image I get an access violation

Procedure SCanImage;
type
  TPixelValue =  record
  case integer of
   1 :(ColorValue : TColor);
   2 :(ColorArray  : array[1..4] of byte);
  end;
var
  HCount, VCount : integer;
  PixelValue : TPixelValue;
begin
  ObjectVisible := false;
  HCount := 1;
  repeat
if Testing then Form1.HCountLabel.Caption := IntToSTr(HCount);
VCount := 1;
repeat
  if Testing then Form1.VCountLabel.Caption := IntToSTr(VCount);

-- Reading the pixel data in the next line gives the access violation
  PixelValue.ColorValue := Form1.Image1.Canvas.Pixels[HCount,VCount];

-- Writing the pixel in this line works okay so it doesn't seem to be 
HCount/VCount out of range
  Form1.Image1.Canvas.Pixels[HCount,VCount] := $;
  if Testing then Application.ProcessMessages;
  If 
((PixelValue.ColorArray[2]+PixelValue.ColorArray[3]+PixelValue.ColorArray[4]) 
 256/100*LowerVisibilityLimit) then
ObjectVisible := true;
inc(VCount);
until ObjectVisible or (VCount = Form1.Image1.Picture.Height-2);
inc(HCount);
  until ObjectVisible or (HCount = Form1.Image1.Picture.Width-2);
end;

When copying this procedure to Delphi 3 it works as expected.

I'm running Suse 10.0 with the latest updates and the latest Lazarus 

-- 
Ger

_
 To unsubscribe: mail [EMAIL PROTECTED] with
unsubscribe as the Subject
   archives at http://www.lazarus.freepascal.org/mailarchives


Re: [lazarus] Access violation when accessing pixel data

2005-12-05 Thread Alan Chamberlain
I had a similar problem porting a Delphi 7 app to Lazarus. I solved it
by using LazIntfImage as below:

var I,J,
Xres,YRes: integer;
Val:   longint;
SrcIntfImage:TLazIntfImage;
Curcolor   :TFPColor;
Data:  array of real;

begin
with OpenDialog do
   begin
   DefaultExt := '.bmp';
   Filter := 'Windows bitmap|*.bmp|Tiff bitmap|*.tif|All files|*.*';
   FileName := ImageFile;
   Title := 'Save Image';
   end;
if OpenDialog.Execute then
   begin
   ImageFile := OpenDialog.FileName;
   Camera.Picture.LoadFromFile(Imagefile);
   Camera.Refresh;

   XRes := Camera.Picture.BitMap.Width;
   YRes := Camera.Picture.BitMap.Height;
   SrcIntfImage := TLazIntfImage.Create(0,0);
 
SrcIntfImage.loadFromBitmap(Camera.Picture.BitMap.Handle,Camera.Picture.BitMap.MaskHandle);
  SetLength(Data,XRes*YRes*2 + 4);
  for I:=1 to YRes do
 for J:=1 to XRes do
begin
CurColor := SrcIntfImage.Colors[J-1,I-1];
Val := CurColor.Red;
Data[(I-1)*XRes*2 + J*2 - 1] := Val;
end;
  SrcIntfImage.Free;
  end;
   end;
end;

Hope this helps.

Cheers
Alanphys

On Mon, 2005-12-05 at 11:25, Ger Remmers wrote:
 Hi all,
 
 When trying to read the pixel data in an image I get an access violation
 
 Procedure SCanImage;
 type
   TPixelValue =  record
   case integer of
1 :(ColorValue : TColor);
2 :(ColorArray  : array[1..4] of byte);
   end;
 var
   HCount, VCount : integer;
   PixelValue : TPixelValue;
 begin
   ObjectVisible := false;
   HCount := 1;
   repeat
 if Testing then Form1.HCountLabel.Caption := IntToSTr(HCount);
 VCount := 1;
 repeat
   if Testing then Form1.VCountLabel.Caption := IntToSTr(VCount);
 
 -- Reading the pixel data in the next line gives the access violation
   PixelValue.ColorValue := Form1.Image1.Canvas.Pixels[HCount,VCount];
 
 -- Writing the pixel in this line works okay so it doesn't seem to be 
 HCount/VCount out of range
   Form1.Image1.Canvas.Pixels[HCount,VCount] := $;
   if Testing then Application.ProcessMessages;
   If 
 ((PixelValue.ColorArray[2]+PixelValue.ColorArray[3]+PixelValue.ColorArray[4]) 
  256/100*LowerVisibilityLimit) then
 ObjectVisible := true;
 inc(VCount);
 until ObjectVisible or (VCount = Form1.Image1.Picture.Height-2);
 inc(HCount);
   until ObjectVisible or (HCount = Form1.Image1.Picture.Width-2);
 end;
 
 When copying this procedure to Delphi 3 it works as expected.
 
 I'm running Suse 10.0 with the latest updates and the latest Lazarus 
-- 
Dr A C Chamberlain
Acting HOD: Medical Physics
Medunsa Campus: University of Limpopo

_
 To unsubscribe: mail [EMAIL PROTECTED] with
unsubscribe as the Subject
   archives at http://www.lazarus.freepascal.org/mailarchives