Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Okay. I am sure that once again I

Status
Not open for further replies.

Fluke026

Programmer
Aug 20, 2002
32
0
0
US
Okay. I am sure that once again I have a simple problem, but the solution escapes me. It seems like the simpler the problem, the harder it is to see the solution.

I have a class [MoveMent = class(TPersistent)] that just spontaneously loses its settings between function calls. I call the constructor then return to the GUI. Taking advantage of the debugging tools shows me that this is okay up to this point. When I call an event that accesses the data of Movement, Movement is just full of weird data.

What is going on on?
 
I think you need to give us a few more clues. I suspect that when you refer to class you mean an instance of the class MoveMent ie an Object. (Note that it is conventional to prefix class names with the letter 'T'.)

Have you called the MoveMent constructor?
Code:
movem := MoveMent.Create;

If movem was not properly constructed then it might have any old address in it which is likely to give the kind of symptoms you describe.

Andrew
 
I found it. The problem in TMovement was a bad copy constructor. Instead of creating another instance of the correct TMovement, I was creating a pointer to it. When I freed my copy, I freed the original also.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top