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

Jason Harris kstars at 30doradus.org
Fri Jul 8 07:56:36 CEST 2005


SVN commit 432669 by harris:

Possible fix for bug #106501 (crash while downloading Steinicke NGC 
catalog from GHNS)

I never confirmed a crash, but I did see odd behavior in downloading the 
Steinicke catalog:  console output indicates that it reads the new 
catalog into memory three times, which causes a long UI delay.  I tried 
to understand why it's happening, but I don't think I succeeded.  As a 
workaround, I added a bool member "NGCUpdated" to KSNewStuff, which 
starts out false and is set true by the installation of the Steinicke 
NGC catalog.  The installation will not be attempted if NGCUpdated is 
true.

Please test to see if this resolves your crash condition.

BUG: 106501
CCMAIL: kstars-devel at kde.org



 M  +10 -4     ksnewstuff.cpp  
 M  +3 -1      ksnewstuff.h  


--- trunk/KDE/kdeedu/kstars/kstars/ksnewstuff.cpp #432668:432669
@@ -38,7 +38,7 @@
 #include "skymap.h"
 
 KSNewStuff::KSNewStuff( QWidget *parent ) :
-  QObject(), KNewStuff( "kstars", parent )
+  QObject(), KNewStuff( "kstars", parent ), NGCUpdated( false )
 {
 	ks = (KStars*)parent;
 	kdw = new KDirWatch( this );
@@ -73,13 +73,13 @@
 	QDir qd( path );
 	qd.setSorting( QDir::Time );
 	qd.setFilter( QDir::Files );
-	
+
 	//Show the Wait cursor
 	ks->setCursor(QCursor(Qt::WaitCursor));
 	
 	
 	//Handle the Steinicke NGC/IC catalog
-	if ( qd[0].contains( "ngcic" ) ) {
+	if ( !NGCUpdated && qd[0].contains( "ngcic" ) ) {
 		//Build a progress dialog to show during data installation.
 		KProgressDialog prog( 0, "newstuffprogdialog", 
 				i18n( "Please Wait" ), i18n( "Installing Steinicke NGC/IC catalog..." ), false /*modal*/ );
@@ -87,7 +87,7 @@
 		prog.setMinimumDuration( 0 /*millisec*/ );
 		prog.progressBar()->setTotalSteps( 0 );  //show generic progress activity
 		prog.show();
-		kapp->processEvents(100);
+		kapp->processEvents(1000);
 		
 		//First, remove the existing NGC/IC objects from the ObjectNameList.
 		for ( DeepSkyObject *o = ks->data()->deepSkyList.first(); o; o = ks->data()->deepSkyList.next() ) {
@@ -106,10 +106,14 @@
 		
 		//Send progress messages to the console
 		connect( ks->data(), SIGNAL( progressText(QString) ), ks->data(), SLOT( slotConsoleMessage(QString) ) );
+		connect( ks->data(), SIGNAL( progressText(QString) ), ks->data(), SLOT( slotProcessEvents() ) );
 		
 		//We are now ready to read the new NGC/IC catalog
 		ks->data()->readDeepSkyData();
 		
+		//Avoid redundant installs
+		NGCUpdated = true;
+
 		//Re-assign image/info links.  3rd param means deep-sky objects only
 		ks->data()->readURLData( "image_url.dat", 0, true ); 
 		ks->data()->readURLData( "info_url.dat", 1, true ); 
@@ -157,6 +161,8 @@
 	ks->setCursor(QCursor(Qt::ArrowCursor));
 }
 
+void KSNewStuff::slotProcessEvents() { kapp->processEvents( 500 ); }
+
 #include "ksnewstuff.moc"
 
 #endif // KDE >= 3.2.90
--- trunk/KDE/kdeedu/kstars/kstars/ksnewstuff.h #432668:432669
@@ -56,10 +56,12 @@
 
 	public slots:
 		void updateData( const QString &newFile );
- 
+ 		void slotProcessEvents();
+
 	private:
 		KDirWatch *kdw;
 		KStars *ks;
+		bool NGCUpdated;
 };
 
 #endif  // KDE >= 3.2.90


More information about the Kstars-devel mailing list