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>]
Summary: KOrganizerPart crashes the application when it is embedded to show an ICS fil...
Status: RESOLVED FIXED
Alias: None
Product: korganizer
Classification: Applications
Component: embedded (show other bugs)
Version: unspecified
Platform: Unlisted Binaries Linux
: NOR crash
Target Milestone: ---
Assignee: Cornelius Schumacher
URL:
Keywords:
: 187547 207909 216332 245022 253195 255059 316675 (view as bug list)
Depends on:
Blocks:
 
Reported: 2009-08-30 18:52 UTC by Ricardo
Modified: 2013-07-11 18:03 UTC (History)
14 users (show)

See Also:
Latest Commit:
Version Fixed In: 4.12


Attachments
this is the file that when opening, krusader crashes (108 bytes, application/octet-stream)
2009-08-30 18:56 UTC, Ricardo
Details
diff (1.23 KB, text/plain)
2012-08-19 11:15 UTC, Jan Lepper
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Ricardo 2009-08-30 18:52:31 UTC
Application that crashed: krusader
Version of the application: 2.0.0 "Mars Pathfinder"
KDE Version: 4.3.00 (KDE 4.3.0) "release 158"
Qt Version: 4.5.2
Operating System: Linux 2.6.27.29-0.1-default i686

What I was doing when the application crashed:
The crash happens everytime i open a specific file pressing F3. I will attach the file

 -- Backtrace:
Application: Krusader (krusader), signal: Segmentation fault
[KCrash Handler]
#6  0xb61bf4d6 in QWidget::window() const () from /usr/lib/libQtGui.so.4
#7  0xab024669 in ?? () from /usr/lib/kde4/korganizerpart.so
#8  0xab025572 in QObject* KPluginFactory::createPartInstance<KOrganizerPart>(QWidget*, QObject*, QList<QVariant> const&) () from /usr/lib/kde4/korganizerpart.so
#9  0xb702120f in KPluginFactory::create(char const*, QWidget*, QObject*, QList<QVariant> const&, QString const&) () from /usr/lib/libkdecore.so.5
#10 0x08151751 in KPluginFactory::create (this=0x86f9830, parent=0x8669170, classname=0x866cf30 "KParts::ReadOnlyPart", args=@0xbfdb9e3c) at /usr/include/kpluginfactory.h:344
#11 0x08150e7e in PanelViewer::getPart (this=0x8669170, mimetype=
      {static null = {<No data fields>}, static shared_null = {ref = {_q_value = 11263}, alloc = 0, size = 0, data = 0x82edcd2, clean = 0, simpletext = 0, righttoleft = 0, asciiCache = 0, capacity = 0, reserved = 0, array = {0}}, static shared_empty = {ref = {_q_value = 309}, alloc = 0, size = 0, data = 0xb5f3648e, clean = 0, simpletext = 0, righttoleft = 0, asciiCache = 0, capacity = 0, reserved = 0, array = {0}}, d = 0xbfdb9ec0, static codecForCStrings = 0x0}) at /usr/src/debug/krusader-2.0.0/krusader/KViewer/panelviewer.cpp:139
#12 0x081512b6 in PanelViewer::openUrl (this=0x8669170, url=@0xbfdb9f58, mode=KrViewer::Generic) at /usr/src/debug/krusader-2.0.0/krusader/KViewer/panelviewer.cpp:77
#13 0x0814b1b0 in KrViewer::view (url={<QUrl> = {d = 0xbfdb9f58}, d = 0x0}, mode=KrViewer::Generic, new_window=<value optimized out>, parent=0xbfdbc474)
    at /usr/src/debug/krusader-2.0.0/krusader/KViewer/krviewer.cpp:289
#14 0x0814b402 in KrViewer::view (url={<QUrl> = {d = 0xbfdb9fcc}, d = 0xbfdbc474}, parent=0xbfdbc474) at /usr/src/debug/krusader-2.0.0/krusader/KViewer/krviewer.cpp:282
#15 0x08168c9e in ListPanelFunc::view (this=0x8564a88) at /usr/src/debug/krusader-2.0.0/krusader/Panel/panelfunc.cpp:383
#16 0x080b311b in KRslots::qt_metacall (this=0x8391bf8, _c=QMetaObject::InvokeMetaMethod, _id=102, _a=0xbfdba14c) at /usr/src/debug/krusader-2.0.0/krusader/krslots.cpp:609
#17 0xb5e53788 in QMetaObject::activate(QObject*, int, int, void**) () from /usr/lib/libQtCore.so.4
#18 0xb5e53bc0 in QMetaObject::activate(QObject*, QMetaObject const*, int, int, void**) () from /usr/lib/libQtCore.so.4
#19 0xb6171181 in QAction::triggered(bool) () from /usr/lib/libQtGui.so.4
#20 0xb61726ff in QAction::activate(QAction::ActionEvent) () from /usr/lib/libQtGui.so.4
#21 0xb61751fb in QAction::event(QEvent*) () from /usr/lib/libQtGui.so.4
#22 0xb7602d19 in KAction::event(QEvent*) () from /usr/lib/libkdeui.so.5
#23 0xb61777fc in QApplicationPrivate::notify_helper(QObject*, QEvent*) () from /usr/lib/libQtGui.so.4
#24 0xb617faee in QApplication::notify(QObject*, QEvent*) () from /usr/lib/libQtGui.so.4
#25 0xb76e776d in KApplication::notify(QObject*, QEvent*) () from /usr/lib/libkdeui.so.5
#26 0xb5e3e16b in QCoreApplication::notifyInternal(QObject*, QEvent*) () from /usr/lib/libQtCore.so.4
#27 0xb61b0c28 in ?? () from /usr/lib/libQtGui.so.4
#28 0xb61b2b2f in ?? () from /usr/lib/libQtGui.so.4
#29 0xb6180d90 in QApplication::notify(QObject*, QEvent*) () from /usr/lib/libQtGui.so.4
#30 0xb76e776d in KApplication::notify(QObject*, QEvent*) () from /usr/lib/libkdeui.so.5
#31 0xb5e3e16b in QCoreApplication::notifyInternal(QObject*, QEvent*) () from /usr/lib/libQtCore.so.4
#32 0xb61786de in ?? () from /usr/lib/libQtGui.so.4
#33 0xb6214970 in ?? () from /usr/lib/libQtGui.so.4
#34 0xb6216b5e in ?? () from /usr/lib/libQtGui.so.4
#35 0xb61ed9e4 in QApplication::x11ProcessEvent(_XEvent*) () from /usr/lib/libQtGui.so.4
#36 0xb62185ea in ?? () from /usr/lib/libQtGui.so.4
#37 0xb54e39c8 in g_main_context_dispatch () from /usr/lib/libglib-2.0.so.0
#38 0xb54e7083 in ?? () from /usr/lib/libglib-2.0.so.0
#39 0xb54e7241 in g_main_context_iteration () from /usr/lib/libglib-2.0.so.0
#40 0xb5e698d8 in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/libQtCore.so.4
#41 0xb6217ce5 in ?? () from /usr/lib/libQtGui.so.4
#42 0xb5e3c78a in QEventLoop::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/libQtCore.so.4
#43 0xb5e3cbd2 in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/libQtCore.so.4
#44 0xb5e3f079 in QCoreApplication::exec() () from /usr/lib/libQtCore.so.4
#45 0xb6177677 in QApplication::exec() () from /usr/lib/libQtGui.so.4
#46 0x08093095 in main (argc=5, argv=0xbfdbcc04) at /usr/src/debug/krusader-2.0.0/krusader/main.cpp:268

Reported using DrKonqi
Comment 1 Ricardo 2009-08-30 18:56:10 UTC
Created attachment 36579 [details]
this is the file that when opening, krusader crashes

It used to be an ics file, but it got corrupted somehow
Comment 2 Dario Andres 2009-09-02 04:37:31 UTC
- Can you check if opening that file with KOrganizer directly will crash it too ?
- Do you have any other non-corrupted ICS file to test in Krusader and see if it crashes ?

I think the crash is more related to embbeding the KOrganizerPart into Krusader

Thanks
Comment 3 Ricardo 2009-09-02 12:19:07 UTC
i tried with a non-corrupt ics file, and happens the same: krusader crash
(with korganizer is okay)
so yes, it seems to be related to using the kpart

On Wed, Sep 2, 2009 at 4:37 AM, Dario Andres <andresbajotierra@gmail.com>wrote:

> https://bugs.kde.org/show_bug.cgi?id=205713
>
>
> Dario Andres <andresbajotierra@gmail.com> changed:
>
>           What    |Removed                     |Added
>
> ----------------------------------------------------------------------------
>                 CC|                            |andresbajotierra@gmail.com
> ,
>                   |                            |kdepim-bugs@kde.org
>
>
>
>
> --- Comment #2 from Dario Andres <andresbajotierra gmail com>  2009-09-02
> 04:37:31 ---
> - Can you check if opening that file with KOrganizer directly will crash it
> too
> ?
> - Do you have any other non-corrupted ICS file to test in Krusader and see
> if
> it crashes ?
>
> I think the crash is more related to embbeding the KOrganizerPart into
> Krusader
>
> Thanks
>
> --
> Configure bugmail: https://bugs.kde.org/userprefs.cgi?tab=email
> ------- You are receiving this mail because: -------
> You are a voter for the bug.
> You reported the bug.
>
Comment 4 Dario Andres 2009-09-19 21:26:07 UTC
*** Bug 207909 has been marked as a duplicate of this bug. ***
Comment 5 Dario Andres 2010-11-18 17:47:56 UTC
[Comment from a bug triager]
From bug 245022:
-- Information about the crash:
Krusader crashed (reproducibly) when I attempted to F3
~/.kde/share/apps/korganizer/std.ics. F4 was fine.

From bug 253195:
-- Information about the crash:
When trying to view (using F3) any .vfb file Krussader always crashes. Using
the default viewer. Can provide the file if needed.
Comment 6 Dario Andres 2010-11-18 17:48:01 UTC
*** Bug 245022 has been marked as a duplicate of this bug. ***
Comment 7 Dario Andres 2010-11-18 17:48:05 UTC
*** Bug 253195 has been marked as a duplicate of this bug. ***
Comment 8 Dario Andres 2010-11-18 17:50:16 UTC
*** Bug 216332 has been marked as a duplicate of this bug. ***
Comment 9 Dario Andres 2010-11-18 17:50:33 UTC
[Comment from a bug triager]
Bug 216332 mentions a way to trigger the bug using the PyQt bindings. The full
PyQt code is available at https://bugs.kde.org/show_bug.cgi?id=216332#c1
Comment 10 Dario Andres 2010-11-18 17:52:46 UTC
*** Bug 187547 has been marked as a duplicate of this bug. ***
Comment 11 Dario Andres 2011-01-30 23:21:54 UTC
From bug 255059 (KDE SC 4.5.1):
- What I was doing when the application crashed:
I was browsing the events page on my last.fm profile, and wanted to import my
calendar from there into Korganizer in ICS format. I clicked the link and then
Open in the dialog box asking what I wanted to do with the downloaded file.
After clicking Open, rekonq crashed.

- Updated backtrace:
[KCrash Handler]
#6  parent (this=0x0) at
../../include/QtCore/../../src/corelib/kernel/qobject.h:250
#7  parentWidget (this=0x0) at
../../include/QtGui/../../src/gui/kernel/qwidget.h:1022
#8  QWidget::window (this=0x0) at kernel/qwidget.cpp:4182
#9  0x00007f1c6827c805 in topLevelWidget (this=0x3af8e20, parentWidget=0x0,
parent=0x2830c60, __in_chrg=<value optimized out>, __vtt_parm=<value optimized
out>) at /usr/include/qt4/QtGui/qwidget.h:318
#10 KOrganizerPart::KOrganizerPart (this=0x3af8e20, parentWidget=0x0,
parent=0x2830c60, __in_chrg=<value optimized out>, __vtt_parm=<value optimized
out>) at ../../korganizer/korganizer_part.cpp:53
#11 0x00007f1c6827d54f in KPluginFactory::createPartInstance<KOrganizerPart>
(parentWidget=0x0, parent=0x2830c60, args=...) at
//usr/include/kpluginfactory.h:467
#12 0x00007f1c94da897f in KPluginFactory::create (this=0x3af58e0,
iface=0x7f1c95a66f60 "KParts::ReadOnlyPart", parentWidget=<value optimized
out>, parent=0x2830c60, args=..., keyword=<value optimized out>) at
../../kdecore/util/kpluginfactory.cpp:191
#13 0x00007f1c9678f6b0 in create<KParts::ReadOnlyPart> (this=<value optimized
out>, _mimeType=<value optimized out>, url=<value optimized out>,
argumentNames=<value optimized out>, argumentValues=<value optimized out>) at
../../kdecore/util/kpluginfactory.h:515
#14 createInstance<KParts::ReadOnlyPart> (this=<value optimized out>,
_mimeType=<value optimized out>, url=<value optimized out>,
argumentNames=<value optimized out>, argumentValues=<value optimized out>) at
../../kdecore/services/kservice.h:532
#15 createPartInstanceFromQuery<KParts::ReadOnlyPart> (this=<value optimized
out>, _mimeType=<value optimized out>, url=<value optimized out>,
argumentNames=<value optimized out>, argumentValues=<value optimized out>) at
../../kdecore/services/kmimetypetrader.h:128
#16 KWebPluginFactory::create (this=<value optimized out>, _mimeType=<value
optimized out>, url=<value optimized out>, argumentNames=<value optimized out>,
argumentValues=<value optimized out>) at
../../kdewebkit/kwebpluginfactory.cpp:133
...
Comment 12 Dario Andres 2011-01-30 23:22:27 UTC
*** Bug 255059 has been marked as a duplicate of this bug. ***
Comment 13 Marcin Gryszkalis 2011-05-07 23:04:07 UTC
I cannot confirm this in KDE 4.6.2 and Krusader 2.3.0/git - do anybody still see this in latest versions?
Comment 14 Sergio Martins 2011-06-04 16:10:36 UTC
(In reply to comment #13)
> I cannot confirm this in KDE 4.6.2 and Krusader 2.3.0/git - do anybody still
> see this in latest versions?

Good to hear.

Please reopen if it still happens.
Comment 15 Andreas Weder 2012-01-17 09:23:35 UTC
I still see the crash on ics files in KDE 4.7.4 and krusader 2.4.0-beta1 (git), gentoo.

In Krusader: 
hit F3 on any ics-file --> crash
hit F4 on any ics-file --> works, I can edit the file; view the file in text/hex/lister mode works as well; 
switching to generic viewing mode from edit mode results in a crash again.

Any idea how to fix this?
Comment 16 Jan Lepper 2012-08-16 17:01:08 UTC
The bug is still present in git master.
It occurs when NULL is passed as parent widget to the factory funtion of KOrganizerPart (can be seen from stack trace too).
This could happen by calling KService::createInstance (QObject *parent=0, const QVariantList &args=QVariantList(), QString *error=0) .
KOrganizerPart()  then dereferences the null-pointer.
While the crash can be avoided by passing a valid parent widget (as I have now done in the Krusader case *),
this shouldn't happen and the factory function should cast parent to QWidget if possible - otherwise it should return 0.
Other KParts seem to to that too.

*) http://quickgit.kde.org/index.php?p=krusader.git&a=commit&h=7b1f74a467c8389335fc96fc03ede51e0e710549
Comment 17 Allen Winter 2012-08-18 21:12:25 UTC
Created attachment 73288 [details]
diff

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 );
Comment 18 Jan Lepper 2012-08-19 11:15:56 UTC
On Sat, 18 Aug 2012 21:12:25 +0000
Allen Winter <winter@kde.org> wrote:

> https://bugs.kde.org/show_bug.cgi?id=205713
> 
> Allen Winter <winter@kde.org> changed:
> 
>            What    |Removed                     |Added
> ----------------------------------------------------------------------------
>                  CC|                            |winter@kde.org
> 
> --- Comment #17 from Allen Winter <winter@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.
Comment 19 Jan Lepper 2012-08-19 11:24:25 UTC
On Sun, 19 Aug 2012 13:16:24 +0200
jan <jan_lepper@gmx.de> wrote:

> On Sat, 18 Aug 2012 21:12:25 +0000
> Allen Winter <winter@kde.org> wrote:
> 
> > https://bugs.kde.org/show_bug.cgi?id=205713
> > 
> > Allen Winter <winter@kde.org> changed:
> > 
> >            What    |Removed                     |Added
> > ----------------------------------------------------------------------------
> >                  CC|                            |winter@kde.org
> > 
> > --- Comment #17 from Allen Winter <winter@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
Comment 20 Marcin Gryszkalis 2013-03-16 23:09:37 UTC
*** Bug 316675 has been marked as a duplicate of this bug. ***
Comment 21 Allen Winter 2013-07-11 18:03:15 UTC
Git commit b149f5ea6568e3a0840889af705b3153c56f9452 by Allen Winter.
Committed on 11/07/2013 at 18:00.
Pushed by winterz into branch 'master'.

in the ctor, be careful when setting the toplevelwidget
FIXED-IN: 4.12
REVIEW: 111412

M  +9    -1    korganizer/korganizer_part.cpp

http://commits.kde.org/kdepim/b149f5ea6568e3a0840889af705b3153c56f9452