void KLibLoader::unloadLibrary(const char *libname) { KLibWrapPrivate *wrap = m_libs[libname]; if(!wrap) return; if(--wrap->ref_count) return; // kdDebug(150) << "closing library " << libname << endl; m_libs.remove(libname); disconnect(wrap->lib, SIGNAL(destroyed()), this, SLOT(slotLibraryDestroyed())); close_pending(wrap); }
void KLibLoader::slotLibraryDestroyed() { const KLibrary *lib = static_cast<const KLibrary *>( sender() ); QAsciiDictIterator<KLibWrapPrivate> it( m_libs ); for (; it.current(); ++it ) if ( it.current()->lib == lib ) { KLibWrapPrivate *wrap = it.current(); wrap->lib = 0; /* the KLibrary object is already away */ m_libs.remove( it.currentKey() ); close_pending( wrap ); return; } }
KLibLoader::~KLibLoader() { // kdDebug(150) << "Deleting KLibLoader " << this << " " << name() << endl; QAsciiDictIterator< KLibWrapPrivate > it(m_libs); for(; it.current(); ++it) { kdDebug(150) << "The KLibLoader contains the library " << it.current()->name << " (" << it.current()->lib << ")" << endl; d->pending_close.append(it.current()); } close_pending(0); delete d; d = 0L; }