Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2011-05

Strange access violation

7 messages · 2 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Luca Olivetti

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

Reply by email

Mattias Gaertner
to Luca Olivetti

?
?

Luca Olivetti hat am 4. Mai 2011 um 13:44 geschrieben:

Show quoted text 39 lines
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?

Maybe a heap/stack corruption. Compile with many checks: -ghtl -Criot -Sa The problem is probably in some package you installed.

Mattias
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20110504/deb27eec/attachment-0001.html>

Reply by email

Luca Olivetti
to Mattias Gaertner

Al 04/05/11 17:36, En/na Mattias Gaertner ha escrit:

Show quoted text 5 lines
> > Any idea? Maybe a heap/stack corruption. Compile with many checks: -ghtl -Criot -Sa The problem is probably in some package you installed.

Could be and I'll try that, however it's the same set of packages I've been using for some years without hitting this problem.

Bye

Luca Olivetti Wetron Automatizaci?n S.A. http://www.wetron.es/ Tel. +34 93 5883004 (Ext.133) Fax +34 93 5883007

Reply by email

Mattias Gaertner
to Luca Olivetti
Show quoted text 10 lines
Al 04/05/11 17:36, En/na Mattias Gaertner ha escrit: >> >> Any idea? > > Maybe a heap/stack corruption. Compile with many checks: -ghtl -Criot -Sa > The problem is probably in some package you installed. Could be and I'll try that, however it's the same set of packages I've been using for some years without hitting this problem.

Some bugs can get very old before becoming apparent. Sometimes a bugfix in some other place can do this.

Many lazarus devels test with above checks, but only their set of packages.

Mattias

Reply by email

Luca Olivetti
to Mattias Gaertner

Al 04/05/11 19:24, En/na Mattias Gaertner ha escrit:

Many lazarus devels test with above checks, but only their set of packages.

It's enough to set those options in my project or do I have to set them in every package?
I tried adding those options in
Project->Project options->Compiler options->Other-Custom options

and it didn't rebuild the packages, so I suppose I'll have to set them in every package (or in fpc.cfg and rebuild everything?)

Bye

Luca Olivetti Wetron Automatizaci?n S.A. http://www.wetron.es/ Tel. +34 93 5883004 (Ext.133) Fax +34 93 5883007

Reply by email

Mattias Gaertner
to Luca Olivetti
Show quoted text 11 lines
Al 04/05/11 19:24, En/na Mattias Gaertner ha escrit: > Many lazarus devels test with above checks, but only their set of > packages. It's enough to set those options in my project or do I have to set them in every package? I tried adding those options in Project->Project options->Compiler options->Other-Custom options and it didn't rebuild the packages, so I suppose I'll have to set them in every package (or in fpc.cfg and rebuild everything?)

Yes, every package has its own set of options, so you know you are using the same options as the developer of the package. You could add a macro.
For example many packages contain the macro $(IDEBuildOptions) in their custom options. This macro are the options of the Lazarus build dialog.

Mattias

Reply by email

Luca Olivetti
to Mattias Gaertner: ? ? Luca Olivetti hat am 4. Mai 2011 um 13:44 geschrieben: Maybe a heap/stack…

Al 04/05/2011 17:36, En/na Mattias Gaertner ha escrit:

Luca Olivetti hat am 4. Mai 2011 um 13:44 geschrieben:

...

Show quoted text 8 lines
> 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? Maybe a heap/stack corruption. Compile with many checks: -ghtl -Criot -Sa The problem is probably in some package you installed.

Well, I tried with all packages (except the LCL and FCL)) as well with my application compiled with those options, and while I found a couple of (intentional) range exceptions, I could find nothing else :-(

Bye

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

Reply by email