[Kstars-devel] KDE/kdeedu/kstars/kstars

Jason Harris kstars at 30doradus.org
Sun Jan 22 18:35:14 CET 2006


SVN commit 501353 by harris:

Well, I've gotten the code to run all the way through 
KStars::datainitFinished() before crashing.  This is a slot that runs 
immediately after KStarsData is finished loading all the data from disk.

The problem is, shortly after datainitFinished() has completed, I get a 
crash caused by an index out of bounds in an unnamed QList.  And since 
datainitFinished() is a slot that is triggered at the end of 
KStarsData::slotInitialize(), it isn't easy to figure out exactly where 
the crash is occuring.

My usual trick is to run the program in gdb, because it identifies the 
function in which the crash occurred.  Unfortunately, when running in 
gdb, I don't get a crash at all, rather it seems to enter an infinite 
loop while setting the date and time.  Doesn't happen outside of gdb.  
So that's weird.

I also tried adding a breakpoint in KDevelop, with the hope that I could 
then step through until getting to the crash.  Unfortunately I can't get 
the integrated debugger in KDevelop to work.

So, I'm a bit stuck.  If anyone tries running the current code, please 
post your experiences in this thread.  I guess I'll try inserting some 
debug statements to track down the crash.  Nothing like brute force :/

CCMAIL: kstars-devel at kde.org


 M  +0 -12     kstars.cpp  
 M  +15 -15    kstarsdata.cpp  
 M  +22 -13    kstarsinit.cpp  
 M  +1 -3      skycomponents/skycomposite.cpp  
 M  +4 -2      skycomponents/starcomponent.cpp  


--- trunk/KDE/kdeedu/kstars/kstars/kstars.cpp #501352:501353
@@ -76,12 +76,6 @@
 	//Initialize data.  When initialization is complete, it will run dataInitFinished()
 	kstarsData->initialize();
 
-	//Set Geographic Location
-	kstarsData->setLocationFromOptions();
-
-	//Pause the clock if the user gave the "--paused" arg
-	if ( ! StartClockRunning ) kstarsData->clock()->stop();
-	
 	//set up Dark color scheme for application windows
 	DarkPalette = QPalette(QColor("red4"), QColor("DarkRed"));
 	DarkPalette.setColor( QPalette::Normal, QColorGroup::Base, QColor( "black" ) );
@@ -96,12 +90,6 @@
 #else
 	kdDebug() << "Did not find glibc >= 2.1.  Will use ANSI-compliant sin()/cos() functions." << endl;
 #endif
-
-	//Initialize INDIMenu
-	indimenu = new INDIMenu(this);
-
-	//Initialize Observing List
-	obsList = new ObservingList( this, this );
 }
 
 KStars::~KStars()
--- trunk/KDE/kdeedu/kstars/kstars/kstarsdata.cpp #501352:501353
@@ -210,26 +210,22 @@
 		case 3: //Load Image URLs//
 
 			emit progressText( i18n("Loading Image URLs" ) );
-			if ( !readURLData( "image_url.dat", 0 ) ) {
-				initError( "image_url.dat", false );
-			}
-			//if ( !readURLData( "myimage_url.dat", 0 ) ) {
-			//Don't do anything if the local file is not found.
-			//}
-          // doesn't belong here, only temp
-             readUserLog();
+// 			if ( !readURLData( "image_url.dat", 0 ) ) {
+// 				initError( "image_url.dat", false );
+// 			}
 
+			// doesn't belong here, only temp
+			readUserLog();
+
 			break;
 
 		case 4: //Load Information URLs//
 
 			emit progressText( i18n("Loading Information URLs" ) );
-			if ( !readURLData( "info_url.dat", 1 ) ) {
-				initError( "info_url.dat", false );
-			}
-			//if ( !readURLData( "myinfo_url.dat", 1 ) ) {
-			//Don't do anything if the local file is not found.
-			//}
+// 			if ( !readURLData( "info_url.dat", 1 ) ) {
+// 				initError( "info_url.dat", false );
+// 			}
+
 			break;
 
 		default:
@@ -315,6 +311,8 @@
 	//Turn off animated slews for the next time step.
 	setSnapNextFocus();
 	
+	kdDebug() << "setting DateTime :" << newDate.toString() << ":" << endl;
+
 	clock()->setUTC( newDate );
 	LTime = geo()->UTtoLT( ut() );
 	//set local sideral time
@@ -666,8 +664,10 @@
 			QString sub = line.mid( line.find(':')+1 );
 			QString title = sub.mid( 0, sub.find(':') );
 			QString url = sub.mid( sub.find(':')+1 );
-	
 			SkyObject *o = skyComposite()->findByName(name);
+			//DEBUG
+			if ( o ) 
+				kdDebug() << "object named " << o->name() << " found" << endl;
 			
 			if ( !o ) {
 				kdWarning() << k_funcinfo << name << " not found" << endl;
--- trunk/KDE/kdeedu/kstars/kstars/kstarsinit.cpp #501352:501353
@@ -395,13 +395,22 @@
 	connect( TimeStep, SIGNAL( scaleChanged( float ) ), this, 
 		 SLOT( mapGetsFocus() ) );
 
+	//Set Geographic Location
+	kstarsData->setLocationFromOptions();
+
 	//Initialize Time and Date
 	KStarsDateTime startDate = KStarsDateTime::fromString( StartDateString );
-	if ( startDate.isValid() )
+	if ( ! StartDateString.isEmpty() && startDate.isValid() ) 
 		data()->changeDateTime( geo()->LTtoUT( startDate ) );
-	else 
-		slotSetTimeToNow();
+	else
+		data()->changeDateTime( geo()->LTtoUT( KStarsDateTime::currentDateTime() ) );
 
+	//Initialize INDIMenu
+	indimenu = new INDIMenu(this);
+
+	//Initialize Observing List
+	obsList = new ObservingList( this, this );
+
 	data()->setFullTimeUpdate();
 	updateTime();
 
@@ -409,10 +418,17 @@
 	if ( StartClockRunning )
 		data()->clock()->start();
 
-	//Define the celestial equator, horizon and ecliptic
-	//(must come after date has been set)
-	KSNumbers tempnum(data()->ut().djd());
+// 	//Define the celestial equator, horizon and ecliptic
+// 	//(must come after date has been set)
+// 	KSNumbers tempnum(data()->ut().djd());
 
+	// Connect cache function for Find dialog
+	connect( data(), SIGNAL( clearCache() ), this, 
+		 SLOT( clearCachedFindDialog() ) );
+
+	//Propagate config settings
+	applyConfig();
+
 	//show the window.  must be before kswizard and messageboxes
 	show();
 
@@ -427,13 +443,6 @@
 	//Start listening for DCOP
 	kapp->dcopClient()->resume();
 
-	// Connect cache function for Find dialog
-	connect( data(), SIGNAL( clearCache() ), this, 
-		 SLOT( clearCachedFindDialog() ) );
-
-	//Propagate config settings
-	applyConfig();
-
 	//Show TotD
 	KTipDialog::showTip( "kstars/tips" );
 }
--- trunk/KDE/kdeedu/kstars/kstars/skycomponents/skycomposite.cpp #501352:501353
@@ -63,10 +63,8 @@
 void SkyComposite::init(KStarsData *data)
 {
 	int nCount=0;
-	foreach (SkyComponent *component, components()) {
-		kdDebug() << "init " << nCount++ << endl;
+	foreach (SkyComponent *component, components()) 
 		component->init(data);
-	}
 }
 
 void SkyComposite::update(KStarsData *data, KSNumbers *num )
--- trunk/KDE/kdeedu/kstars/kstars/skycomponents/starcomponent.cpp #501352:501353
@@ -197,8 +197,9 @@
 						processStar( line );
 					}
 
-					//Process events every 250 lines read
-					if ( nLinesRead % 250 == 0 ) kapp->processEvents();
+//Can't process events here, because we need the stars to finish loading on startup
+//					//Process events every 2500 lines read
+//					if ( nLinesRead % 2500 == 0 ) kapp->processEvents();
 				}
 			}
 		}
@@ -263,6 +264,7 @@
 	}
 
 	// HEV: look up star name in internationalization filesource
+	if ( name.isEmpty() ) name = "star";
 	name = i18n("star name", name.local8Bit().data());
 
 // 	//DEBUG


More information about the Kstars-devel mailing list