Memory overwrites
ReportBuilder 10.09 Enterprise Edition
I've written a pass-thru function (GetPeerGraph) that takes a Tstrings
parameter and it returns a bitmap which gets assigned to a ppImage
component. In the DetailBeforePrint event I assign the contents of a memo
field to the text of a stringlist, pass the stringlist and get back a nice
bitmap. All works nicely except if I create and destroy my TStringList as a
local variable, my function gets passed corrupted memory after the second
record is processed, with access violations galore. If my TStringlist is
global all works fine, as does simply using the Lines of a hidden memo in
the report. Is this a bug in RB or is my implementation wrong. Heres the
code that works, using a global Tstringlist in the report:
var
Bitmap : TBitmap;
begin
if (MainQuery['answerstyle'] = 4) or (MainQuery['answerstyle'] = 5) then
begin
Region1.visible := true;
Region2.visible := false;
scoresList.text := MainQuery['Answers'];
Bitmap := GetPeerGraph(scoresList);
image1.picture.assign(Bitmap);
Bitmap.free;
end
else
begin
Region1.visible := false;
Region2.visible := true;
end;
end;
Paul
I've written a pass-thru function (GetPeerGraph) that takes a Tstrings
parameter and it returns a bitmap which gets assigned to a ppImage
component. In the DetailBeforePrint event I assign the contents of a memo
field to the text of a stringlist, pass the stringlist and get back a nice
bitmap. All works nicely except if I create and destroy my TStringList as a
local variable, my function gets passed corrupted memory after the second
record is processed, with access violations galore. If my TStringlist is
global all works fine, as does simply using the Lines of a hidden memo in
the report. Is this a bug in RB or is my implementation wrong. Heres the
code that works, using a global Tstringlist in the report:
var
Bitmap : TBitmap;
begin
if (MainQuery['answerstyle'] = 4) or (MainQuery['answerstyle'] = 5) then
begin
Region1.visible := true;
Region2.visible := false;
scoresList.text := MainQuery['Answers'];
Bitmap := GetPeerGraph(scoresList);
image1.picture.assign(Bitmap);
Bitmap.free;
end
else
begin
Region1.visible := false;
Region2.visible := true;
end;
end;
Paul
This discussion has been closed.
Comments
would like to create a simple, focused example project, we can check it out
here using the debugger. Send in zip format to
support@digital-metpahors.com. Use standard Delphi components and RB.
--
Nard Moseley
Digital Metaphors
www.digital-metaphors.com
Best regards,
Nard Moseley
Digital Metaphors
www.digital-metaphors.com
var
Bitmap : TBitmap;
scoresList : TStringList;
begin
if (MainQuery['answerstyle'] = 4) or (MainQuery['answerstyle'] = 5) then
begin
scoresList := TStringList.create;
Region1.visible := true;
Region2.visible := false;
scoresList.text := MainQuery['Answers'];
Bitmap := GetPeerGraph(scoresList);
image1.picture.assign(Bitmap);
Bitmap.free;
scoresList .free;
end
else
begin
Region1.visible := false;
Region2.visible := true;
end;
end;
If you want a demo project to illustrate, it might be a few weeks..I'm of on
holiday tomorrow
Paul
We need a runnable example to do anything but guess as to what might be
causing the error.
Perhaps you have a global 'scoresList' somewhere else and it is getting
confused (though it shouldn't). As a test renaming it to
var
lScoresList: TStringList;
Have a great holiday and send us an example when you return.
--
Nard Moseley
Digital Metaphors
www.digital-metaphors.com
Best regards,
Nard Moseley
Digital Metaphors
www.digital-metaphors.com
After testing some reports on the new version 10.09 from version 10.06 i
noticied some changes/problems in RAP (we code in RAP completely and pass
some parameters to our reports)
procedure GlobalOnCreate;
begin
if (Report.Parameters['VALORES_ZERO'] = 1) then
begin
Variable8.BlankWhenZero := False;
Variable9.BlankWhenZero := False;
end
else
begin
Variable8.BlankWhenZero := True;
Variable9.BlankWhenZero := True;
end;
end;
procedure Variable1OnCalc(var Value: Variant);
begin
Value := IntToStr(LV['A']) +'/' +IntToStr(LV['B']) +'/'
+IntToStr(LV['C']); {All the fields have values (integer) from the data
source created in report}
end;
both code works in our current version but not in 10.09 (here the error is
(null) to (integer))
Was there major changes in conversion?
TIA
Manuel Troia
There is not a known issue with RB 10.09. Make sure you are using RB 10.09
and not RB 10.08.
Please create a simple, focused test project that can run here in the Delphi
debugger. Use standard Delphi components and RB. Use the DBDemos or dump
some data to a TClientDataSet. Send in zip format to
support@digital-metaphors.com
--
Nard Moseley
Digital Metaphors
www.digital-metaphors.com
Best regards,
Nard Moseley
Digital Metaphors
www.digital-metaphors.com