[Bug 205713] KOrganizerPart crashes the application when it is embedded to show an ICS file (on Krusader as example) [null QWidget::window, QWidget::topLevelWidget, KOrganizerPart, KPluginFactory::createPartInstance<KOrganizerPart>]

Jan Lepper jan_lepper at gmx.de
Sun Aug 19 12:24:25 BST 2012


https://bugs.kde.org/show_bug.cgi?id=205713

--- Comment #19 from Jan Lepper <jan_lepper at gmx.de> ---
On Sun, 19 Aug 2012 13:16:24 +0200
jan <jan_lepper at gmx.de> wrote:

> On Sat, 18 Aug 2012 21:12:25 +0000
> Allen Winter <winter at kde.org> wrote:
> 
> > https://bugs.kde.org/show_bug.cgi?id=205713
> > 
> > Allen Winter <winter at kde.org> changed:
> > 
> >            What    |Removed                     |Added
> > ----------------------------------------------------------------------------
> >                  CC|                            |winter at kde.org
> > 
> > --- Comment #17 from Allen Winter <winter at kde.org> ---
> > Like this?
> > 
> > 
> > --- a/korganizer/korganizer_part.cpp
> > +++ b/korganizer/korganizer_part.cpp
> > @@ -49,7 +49,7 @@ K_PLUGIN_FACTORY( KOrganizerFactory,
> > registerPlugin<KOrganizerPart>(); )
> >  K_EXPORT_PLUGIN( KOrganizerFactory( createAboutData() ) )
> > 
> >  KOrganizerPart::KOrganizerPart( QWidget *parentWidget, QObject
> > *parent, const QVariantList & )
> > -  : KParts::ReadOnlyPart(parent), mTopLevelWidget(
> > parentWidget->topLevelWidget() )
> > +  : KParts::ReadOnlyPart( parent )
> >  {
> >    KGlobal::locale()->insertCatalog( "libkcalutils" );
> >    KGlobal::locale()->insertCatalog( "calendarsupport" );
> > @@ -59,6 +59,11 @@ KOrganizerPart::KOrganizerPart( QWidget
> > *parentWidget, QObject *parent, const QV
> >    KGlobal::locale()->insertCatalog( "libincidenceeditors" );
> >    KGlobal::locale()->insertCatalog( "libkpimutils" );
> > 
> > +  if ( parentWidget ) {
> > +    mTopLevelWidget = parentWidget->topLevelWidget();
> > +  } else {
> > +    mTopLevelWidget = (QWidget *)parent;
> > +  }
> > 
> >    KOCore::self()->addXMLGUIClient( mTopLevelWidget, this );
> > 
> 
> Of course you will have to check if parent is actually a QWidget.
> 

PS: it whould probably be best to implement this behaviour in
KService::createInstance(), analogous to KPluginFactory::create() which
does this already:
http://api.kde.org/4.x-api/kdelibs-apidocs/kdecore/html/classKPluginFactory.html#a93e83b1985db058c44e67515bdcae1f6

-- 
You are receiving this mail because:
You are on the CC list for the bug.



More information about the Kdepim-bugs mailing list