Quickreport forum
Go to Quickreport website
Welcome Guest Search | Active Topics | Log In | Register

TQRExpr and TQREvResult throw an invalid pointer exception
victor@hargal.co.il
#1 Posted : 21 December 2016 15:36:21(UTC)
Rank: Newbie

Groups: Registered
Joined: 21/12/2016(UTC)
Posts: 2
Location: Israel

Thanks: 0 times
Was thanked: 0 time(s) in 0 post(s)
Hello,

We are using quickreports 5.x in a CodeGearâ„¢ C++Builder® 2007 projrct.
Our appplication throws an "invalid pointer" exception when we work with the TQREvResult Value in case of kind of double ("SummaryExpr->Value.dblResult;")
Everything worked well in C++ Builder 3 , these problems had been started after we migrated to C++ Builder 2007.

TControl *CurControl;
TQRExpr *SummaryExpr;
for (int i = 0; i < Count; i++) {
CurControl = this->GroupFooter->Controls[i];
SummaryExpr = dynamic_cast<TQRExpr*>(CurControl);
if (!SummaryExpr) {
continue;
}

switch (SummaryExpr->Value.Kind) {
case resDouble :
ASummaryValue->FieldType = DOUBLE_TYPE;
ASummaryValue->DoubleValue = SummaryExpr->Value.dblResult;
break;
}
//default....
}


It looks like a memory issue. In QREXpr.hpp

struct TQREvResult
{

public:
AnsiString stringValue;
#pragma pack(push,1)
TQREvResultType Kind;
union
{
struct
{
bool booResult;

};
struct
{
unsigned:24;
double dblResult;

};
struct
{
unsigned:24;
int intResult;

};

};
#pragma pack(pop)
} ;


Could you please help to overcome this issue?


Thank you,
Victor
victor@hargal.co.il
#2 Posted : 22 December 2016 12:46:28(UTC)
Rank: Newbie

Groups: Registered
Joined: 21/12/2016(UTC)
Posts: 2
Location: Israel

Thanks: 0 times
Was thanked: 0 time(s) in 0 post(s)
Hi ,

I initialized this memory block with memset , this way :
memset((unsigned char *)&val,0,sizeof(val));
And it worked. Is it a known issue when migrating to CodeGear from older versions?


Thanks,
Victor
Users browsing this topic
Guest (2)
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

Clean Slate theme by Jaben Cargman (Tiny Gecko)
Powered by YAF 1.9.4 | YAF © 2003-2010, Yet Another Forum.NET
This page was generated in 0.028 seconds.