[Kstars-devel] KDE/kdeedu/kstars/kstars
Akarsh Simha
akarshsimha at gmail.com
Sun Aug 23 01:32:38 CEST 2009
SVN commit 1014475 by asimha:
Fix crash under several conditions caused by passing around of a NULL
pointer to the KStars object.
The KStars constructor calls SkyMap::Create() which uses an instance
of KStars obtained by calling KStars::Instance(). Earlier, the pointer
to the instance KStars::pinstance was set only after construction,
which led to segfaults.
This fixes that by setting pinstance to point to the object right away
within KStars::KStars itself.
CCMAIL: kstars-devel at kde.org, prakash.mohan at kdemail.net
M +5 -0 kstars.cpp
--- trunk/KDE/kdeedu/kstars/kstars/kstars.cpp #1014474:1014475
@@ -70,6 +70,9 @@
QDBusConnection::sessionBus().registerObject("/KStars", this);
QDBusConnection::sessionBus().registerService("org.kde.kstars");
+ // Set pinstance to yourself
+ pinstance = this;
+
connect( qApp, SIGNAL( aboutToQuit() ), this, SLOT( slotAboutToQuit() ) );
//Initialize QActionGroups
@@ -77,6 +80,7 @@
cschemeGroup = new QActionGroup( this );
kstarsData = KStarsData::Create();
+ Q_ASSERT( kstarsData );
//Set Geographic Location from Options
kstarsData->setLocationFromOptions();
@@ -124,6 +128,7 @@
if( pinstance )
delete pinstance;
pinstance = new KStars( doSplash, clockrun, startdate );
+ Q_ASSERT( pinstance );
return pinstance;
}
More information about the Kstars-devel
mailing list