Assertion in genericServiceTypePtr() when there is no service type installed

Jaroslaw Staniek js at iidea.pl
Thu Jun 14 21:23:47 BST 2007


Jarosław Staniek said the following, On 2007-06-14 19:22:
> I have installed /opt/kde4/share/kde4/servicetypes/kexihandler.desktop
> by cmake from http://websvn.kde.org/trunk/koffice/kexi/data/
> 
> But received this before crash:
> 
> kio (KTrader): KMimeTypeTrader::weightedOffers( Kexi/Handler, Application )
> kio (KTrader): WARNING: KMimeTypeTrader: mimeType Kexi/Handler not found
> kio (KTrader): query for mimeType Kexi/Handler, Application : returning 0 
> offers
> 
> Should application crash where there is no service type installed (or found)?

Update:
I used KMimeTypeTrader::query() instead of KServiceTypeTrader::query() by 
accident.

Still, I found by the same accident that this method [1] with empty 
'genericServiceType' argument causes assertion[2]:

[1]
  KMimeTypeTrader::query(  	const QString & mimeType,
   const QString &  genericServiceType =QString::fromLatin1("Application"),
   const QString &  constraint = QString()	 ) 	


[2] Assertion (kservicetypeprofile.cpp):

KServiceOfferList KServiceTypeProfile::sortMimeTypeOffers( const 
KServiceOfferList& list, const QString& mimeType, const QString& gene
{
     initStatic();
     KServiceOfferList offers;
     KMimeTypeProfileEntry* profile = findMimeTypeProfile( mimeType, 
genericServiceType );

     KServiceType::Ptr genericServiceTypePtr( 0 );
     if ( !genericServiceType.isEmpty() ) {
         genericServiceTypePtr = KServiceType::serviceType( genericServiceType );
         Q_ASSERT( genericServiceTypePtr );
//^^^^^^^ here ^^^^^^^^^
     }


How about removing this assertion (or replacing with a warning), because 
otherwise default "Application" (#2) argument is a nonsense as if it causes 
assertion.
(or maybe the assertion cannot be reproducted outside of my system?)

-- 
regards / pozdrawiam, Jaroslaw Staniek
  Sponsored by OpenOffice Polska (http://www.openoffice.com.pl/en) to work on
  Kexi & KOffice: http://www.kexi.pl/en, http://www.koffice.org
  KDE3 & KDE4 Libraries for MS Windows: http://kdelibs.com, http://www.kde.org





More information about the kde-core-devel mailing list