Don't use a global object in a library, the order of initialization is undefined

so it can crash if e.g. QString::null hasn't been initialized yet.
Using a pointer instead, with delayed initialization.

svn path=/trunk/KDE/kdepim/; revision=486706
wilder-work
David Faure 21 years ago
parent a49726750f
commit da324c30ae
  1. 4
      callback.cpp
  2. 5
      kmfiltermgr.cpp

@ -79,7 +79,7 @@ bool Callback::mailICal( const QString& to, const QString iCal,
// Try and match the receiver with an identity
const KPIM::Identity& identity =
kmkernel->identityManager()->identityForAddress( receiver() );
if( identity != KPIM::Identity::null )
if( identity != KPIM::Identity::null() )
// Identity found. Use this
msg->setFrom( identity.fullEmailAddr() );
msg->setHeaderField("X-KMail-Identity", QString::number( identity.uoid() ));
@ -119,7 +119,7 @@ QString Callback::receiver() const
int found = 0;
for( QStringList::Iterator it = addrs.begin(); it != addrs.end(); ++it ) {
if( kmkernel->identityManager()->identityForAddress( *it ) !=
KPIM::Identity::null ) {
KPIM::Identity::null() ) {
// Ok, this could be us
++found;
mReceiver = *it;

@ -311,8 +311,9 @@ bool KMFilterMgr::atLeastOneOnlineImapFolderTarget()
QList<KMFilter*>::const_iterator it = mFilters.begin();
for ( ; it != mFilters.end() ; ++it ) {
KMFilter *filter = *it;
QList<KMFilterAction*>::const_iterator jt( filter->actions()->begin() );
for ( ; jt != filter->actions()->end() ; ++jt ) {
QList<KMFilterAction*>::const_iterator jt = filter->actions()->begin();
const QList<KMFilterAction*>::const_iterator jtend = filter->actions()->end();
for ( ; jt != jtend ; ++jt ) {
KMFilterActionWithFolder *f = dynamic_cast<KMFilterActionWithFolder*>(*jt);
if (!f)
continue;

Loading…
Cancel
Save