Hidden bug?

Report bugs, bug fixes and workarounds here.
Avatar
Topic author
Joe
Posts: 162
Joined: 29.02.2004
With us: 20 years 8 months
Location: United Kingdom

Hidden bug?

Post #1by Joe » 19.10.2005, 10:31

A corrupted add-on file in my XP machine incidently (for somehow) assigned a null Orbit pointer to the function which triggered a debugging process that brought me to the code in the source file body.cpp

Code: Select all

 void Body::setOrbit(Orbit* _orbit)
{
  if (orbit == NULL)
      delete orbit;
 orbit = _orbit;
}


Is it correct about if (orbit == NULL) delete orbit; or should it be:

Code: Select all

if (orbit != NULL)
     delete orbit;
Joe
8O

Avatar
Topic author
Joe
Posts: 162
Joined: 29.02.2004
With us: 20 years 8 months
Location: United Kingdom

Post #2by Joe » 25.10.2005, 10:28

it seems my question is of no interests to anyone :oops: , but I wish to get some advice from your programming experts if this is a bug or not?
Joe

8O

steffens
Posts: 162
Joined: 06.11.2003
With us: 21 years
Location: RP Germany

Post #3by steffens » 25.10.2005, 12:57

This definitely looks like a bug (memory leak). This code is present in the latest FT 1.1 version. Don't know if this is triggered though...

steffens

Avatar
Topic author
Joe
Posts: 162
Joined: 29.02.2004
With us: 20 years 8 months
Location: United Kingdom

Post #4by Joe » 26.10.2005, 08:34

Yep, I tried the code

Code: Select all


void Body::setOrbit(Orbit* _orbit)
{
  if (orbit != NULL)
      delete orbit;
 orbit = _orbit;
}


in place of

Code: Select all

void Body::setOrbit(Orbit* _orbit)
{
  if (orbit == NULL)
      delete orbit;
 orbit = _orbit;
}


the problem solved :D . It is a bug.
Joe

8O

steffens
Posts: 162
Joined: 06.11.2003
With us: 21 years
Location: RP Germany

Post #5by steffens » 06.12.2005, 09:01

As a new pre-release seems to be in preparation - this bug is still in CVS. It's easy to fix, so maybe it should be :wink:

steffens

steffens
Posts: 162
Joined: 06.11.2003
With us: 21 years
Location: RP Germany

Post #6by steffens » 14.12.2005, 16:10

Now this bug is in the latest pre-release, congratulations!
Is it going to be in 1.4 final? Or is it not a bug after all?

I can't believe that nobody cares to fix such a simple thing :cry:

steffens

Avatar
dirkpitt
Developer
Posts: 674
Joined: 24.10.2004
With us: 20 years 1 month

Post #7by dirkpitt » 14.12.2005, 16:22

I've posted a heads-up in the developers' mailing list. Hopefully this will be fixed soon.

chris
Site Admin
Posts: 4211
Joined: 28.01.2002
With us: 22 years 9 months
Location: Seattle, Washington, USA

Post #8by chris » 14.12.2005, 18:09

The memory leak is fixed now. Thanks for pointing it out, and thanks to dirkpitt for mentioning it on the developers list.

--Chris


Return to “Bugs”