[Lazarus] Strange access violation

Luca Olivetti luca at wetron.es
Wed May 4 13:44:48 CEST 2011


Lately I'm getting a bunch of those. I thought it was because I was 
using an old version of lazarus, but now I upgraded to 0.9.30 (self 
compiled from http:://svn.freepascal.org/svn/lazarus/tags_lazarus_0_9_30 
with fpc 2.4.2 under win32) and I got another strange one.

The exception, according to the stack trace, is in line 27 of monitor.inc:

function TMonitor.GetInfo(out Info: TMonitorInfo): Boolean;
begin
   Info.cbSize := SizeOf(TMonitorInfo);
   Result := GetMonitorInfo(Handle, @Info); <<--here
end;


Called from here:

function TMonitor.GetBoundsRect: TRect;
var
   Info: TMonitorInfo;
begin
   if GetInfo(Info) then <<--here
     Result := Info.rcMonitor
   else
     Result := Rect(0, 0, 0, 0);
end;

So I don't understand how an access violation is possible (unless 
windows doesn't look at the cbSize field and tries to access past its 
size). I suspect that the PC where the program is running has some 
problem (maybe a virus?), since I got another access violation on the 
same PC (actually I don't know, I didn't manage to get a stack trace, 
the main form just "vanished" after pressing a button, a different one 
than this time, and that prompted me to upgrade lazarus) but I'm worried.

Of course it isn't reproducible (it happened only once, inside a 
TOpendialog.Execute, I tried many many times after the access violation 
with no problem).

Any idea?

Bye
-- 
Luca Olivetti
Wetron Automation Technology http://www.wetron.es
Tel. +34 935883004 (Ext.133)  Fax +34 935883007




More information about the Lazarus mailing list