MovingAverage function codeguard error

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
yashab
Newbie
Newbie
Posts: 4
Joined: Mon Jul 07, 2003 4:00 am
Location: Israel
Contact:

MovingAverage function codeguard error

Post by yashab » Thu Mar 18, 2004 1:17 pm

I am using: TeeChart 7 (it happens in TeeChart6 too), BCB 6.0 with SP4

I am getting code guard error on:
TMovingAverageFunction *TeeFunction = new TMovingAverageFunction( NULL );


It happens only with Moving Avarage function. All other financial functions work fine.
Here code guard, .cpp and .h files

Code guard file:

Error 00103. 0x130C10 (Thread 0x04D0):
Method called on illegally casted object: Attempt to access 80 byte(s) at
0x015AE730. The 'this' pointer points to heap block 0x015AE730 which is only
76 bytes long.
Call Tree:
0x00401F31(=Project2.exe:0x01:000F31) ..\..\..\TeeChart 7 for C++ Builder 6\CBuilder6\Include\StatChar.hpp#51
0x00401DF1(=Project2.exe:0x01:000DF1) C:\Borland\CBuilder6\Projects\TESTMA\Unit1.cpp#16
0x400F59A4(=vcl60.bpl:0x01:0449A4)
0x00401895(=Project2.exe:0x01:000895) C:\Borland\CBuilder6\Projects\TESTMA\Project2.cpp#13
0x3267E52F(=CC3260MT.DLL:0x01:07D52F)

The memory block (0x015AE730) [size: 76 bytes] was allocated with SysGetMem
Call Tree:
0x40002FCF(=rtl60.bpl:0x01:001FCF)
0x00401DF1(=Project2.exe:0x01:000DF1) C:\Borland\CBuilder6\Projects\TESTMA\Unit1.cpp#16
0x400F59A4(=vcl60.bpl:0x01:0449A4)
0x00401895(=Project2.exe:0x01:000895) C:\Borland\CBuilder6\Projects\TESTMA\Project2.cpp#13
0x3267E52F(=CC3260MT.DLL:0x01:07D52F)


unit1.cpp file:
//---------------------------------------------------------------------------

#include <vcl.h>
#pragma hdrstop

#include "Unit1.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma link "StatChar"
#pragma resource "*.dfm"
TForm1 *Form1;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
: TForm(Owner)
{
TMovingAverageFunction *TeeFunction2 = new TMovingAverageFunction( NULL);
}
//---------------------------------------------------------------------------


unit1.h file:

//---------------------------------------------------------------------------

#ifndef Unit1H
#define Unit1H
//---------------------------------------------------------------------------
#include <Classes.hpp>
#include <Controls.hpp>
#include <StdCtrls.hpp>
#include <Forms.hpp>
#include <Chart.hpp>
#include <ExtCtrls.hpp>
#include <TeEngine.hpp>
#include <TeeProcs.hpp>
#include "StatChar.hpp"
#include <Series.hpp>
//---------------------------------------------------------------------------
class TForm1 : public TForm
{
__published: // IDE-managed Components
TChart *Chart1;
TLineSeries *Series1;
TMovingAverageFunction *TeeFunction1;
private: // User declarations
public: // User declarations
__fastcall TForm1(TComponent* Owner);
};
//---------------------------------------------------------------------------
extern PACKAGE TForm1 *Form1;
//---------------------------------------------------------------------------
#endif

Marjan
Site Admin
Site Admin
Posts: 745
Joined: Fri Nov 07, 2003 5:00 am
Location: Slovenia
Contact:

Post by Marjan » Fri Mar 19, 2004 5:50 am

Hi.

Have you set the moving average function period to positive value ? Also, try setting the owner of function to a valid series.
Marjan Slatinek,
http://www.steema.com

yashab
Newbie
Newbie
Posts: 4
Joined: Mon Jul 07, 2003 4:00 am
Location: Israel
Contact:

Post by yashab » Sun Mar 21, 2004 2:18 pm

The code guard finds the problem in TMovingAverageFunction() constructor.
What parameters should I pass to it?
I tried: this, TChart1, Series1 -- nothing help.


After the following code: (TChart1 and Series1 are created with TChart editor. MA_Series and TeeFunction1 are dinamically created)

Series1->FillSampleValues(100);
TMovingAverageFunction *TeeFunction1 = new TMovingAverageFunction(Chart1);
TeeFunction1->Period = 4;
TChartSeries *MA_Series = new TFastLineSeries(this);
MA_Series->ParentChart = Chart1;
MA_Series->DataSource = Series1;
MA_Series->SetFunction(TeeFunction1);

all works fine, but the code guard finds problems in the second line:
TMovingAverageFunction *TeeFunction1 = new TMovingAverageFunction(Chart1);

What I am doing wrong?

Leroy Casterline
Newbie
Newbie
Posts: 50
Joined: Wed Mar 10, 2004 5:00 am

Re: MovingAverage function codeguard error

Post by Leroy Casterline » Tue Oct 19, 2004 6:05 pm

8440041 wrote:I am using: TeeChart 7 (it happens in TeeChart6 too), BCB 6.0 with SP4

I am getting code guard error on:
TMovingAverageFunction *TeeFunction = new TMovingAverageFunction( NULL );


It happens only with Moving Avarage function. All other financial functions work fine.
Here code guard, .cpp and .h files

Code guard file:

Error 00103. 0x130C10 (Thread 0x04D0):
Method called on illegally casted object: Attempt to access 80 byte(s) at
0x015AE730. The 'this' pointer points to heap block 0x015AE730 which is only
76 bytes long.
Call Tree:
0x00401F31(=Project2.exe:0x01:000F31) ..\..\..\TeeChart 7 for C++ Builder 6\CBuilder6\Include\StatChar.hpp#51
0x00401DF1(=Project2.exe:0x01:000DF1) C:\Borland\CBuilder6\Projects\TESTMA\Unit1.cpp#16
0x400F59A4(=vcl60.bpl:0x01:0449A4)
0x00401895(=Project2.exe:0x01:000895) C:\Borland\CBuilder6\Projects\TESTMA\Project2.cpp#13
0x3267E52F(=CC3260MT.DLL:0x01:07D52F)

The memory block (0x015AE730) [size: 76 bytes] was allocated with SysGetMem
Call Tree:
0x40002FCF(=rtl60.bpl:0x01:001FCF)
0x00401DF1(=Project2.exe:0x01:000DF1) C:\Borland\CBuilder6\Projects\TESTMA\Unit1.cpp#16
0x400F59A4(=vcl60.bpl:0x01:0449A4)
0x00401895(=Project2.exe:0x01:000895) C:\Borland\CBuilder6\Projects\TESTMA\Project2.cpp#13
0x3267E52F(=CC3260MT.DLL:0x01:07D52F)
I, too, am running into this problem. I find this:

Attempt to access 80 byte(s) at 0x015AE730. The 'this' pointer points to heap block 0x015AE730 which is only 76 bytes long.

particularly unnerving. Has Steema resolved this problem?

Post Reply