KLibLoader + KPartFactory + loading oneself problem.

George Staikos staikos at kde.org
Sat Jun 7 17:36:53 BST 2003


On Saturday 07 June 2003 11:55, Luis Pedro Coelho wrote:
> -    m_gvpart = new KGVPart( this, "kgvpart", this, "kgvpart" );
> +    m_gvpart = dynamic_cast<KGVPart*>( KLibLoader::self()->factory(
> "libkghostviewpart" )->create( this, "kgvpart", "KGVPart" ) );
>
> This increments the reference count and prevents the library from being
> unloaded and everything seems to work.
>
> Is this a good solution or a hack?

   You have to check the return code of dynamic_cast for 0L.

-- 
George Staikos
KDE Developer				http://www.kde.org/
Staikos Computing Services Inc.		http://www.staikos.net/





More information about the kde-core-devel mailing list