[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: KDE/kdeedu/kstars/kstars
From: Akarsh Simha <akarshsimha () gmail ! com>
Date: 2008-05-30 20:04:27
Message-ID: 1212177867.955502.10504.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 814596 by asimha:
Fixing management of static data in KSMoon, by adding a static
variable that keeps track of the number of instances of KSMoon and
destroys the static data only when all instances are destroyed.
CCMAIL: kstars-devel@kde.org
M +8 -2 ksmoon.cpp
M +1 -0 ksmoon.h
--- trunk/KDE/kdeedu/kstars/kstars/ksmoon.cpp #814595:814596
@@ -32,16 +32,22 @@
KSMoon::KSMoon(KStarsData *kd)
: KSPlanetBase( kd, I18N_NOOP( "Moon" ), QString(), QColor("white"), 3474.8 /*diameter in km*/ )
{
+ instance_count++;
//Reset object type
setType( SkyObject::MOON );
}
KSMoon::~KSMoon() {
- while ( ! LRData.isEmpty() ) delete LRData.takeFirst();
- while ( ! BData.isEmpty() ) delete BData.takeFirst();
+ instance_count--;
+ if(instance_count <= 0) {
+ while ( ! LRData.isEmpty() ) delete LRData.takeFirst();
+ while ( ! BData.isEmpty() ) delete BData.takeFirst();
+ data_loaded = false;
+ }
}
bool KSMoon::data_loaded = false;
+int KSMoon::instance_count = 0;
QList<KSMoon::MoonLRData*> KSMoon::LRData;
QList<KSMoon::MoonBData*> KSMoon::BData;
--- trunk/KDE/kdeedu/kstars/kstars/ksmoon.h #814595:814596
@@ -85,6 +85,7 @@
private:
dms Phase;
static bool data_loaded;
+ static int instance_count;
/**@class MoonLRData
*Encapsulates the Longitude and radius terms of the sums
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic