Bug 258560 - kontact crash alone, after a certain time
Summary: kontact crash alone, after a certain time
Status: RESOLVED FIXED
Alias: None
Product: korganizer
Classification: Applications
Component: general (show other bugs)
Version: 4.6 pre
Platform: openSUSE Linux
: NOR crash
Target Milestone: ---
Assignee: kdepim bugs
URL:
Keywords:
: 258670 (view as bug list)
Depends on:
Blocks:
 
Reported: 2010-12-02 14:00 UTC by Bruno Friedmann
Modified: 2010-12-31 01:52 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments
New crash information added by DrKonqi (4.69 KB, text/plain)
2010-12-03 19:52 UTC, Bruno Friedmann
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Bruno Friedmann 2010-12-02 14:00:52 UTC
Application: kontact (4.6 pre)
KDE Platform Version: 4.5.80 (4.6 Beta1)
Qt Version: 4.7.1
Operating System: Linux 2.6.37-rc3-git6-8-desktop x86_64
Distribution: "openSUSE 11.4 Milestone 4 of 6 (x86_64)"

-- Information about the crash:
- What I was doing when the application crashed: I've open kontact check rss with akregator, and put the week view on.
After that, I do other thing in other desktop. and suddenly it crash.

Don't know if it's happen every time or not ( have the new version 4.6b1 running only from this morning )

The crash can be reproduced some of the time.

-- Backtrace:
Application: Kontact (kontact), signal: Segmentation fault
[Current thread is 1 (Thread 0x7f6ee61f2760 (LWP 8369))]

Thread 2 (Thread 0x7f6eceec8700 (LWP 8370)):
#0  pthread_cond_wait@@GLIBC_2.3.2 () at ../nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S:162
#1  0x00007f6ee2c96d84 in WTF::TCMalloc_PageHeap::runScavengerThread(void*) () from /usr/lib64/libQtWebKit.so.4
#2  0x00007f6ede678a4f in start_thread (arg=0x7f6eceec8700) at pthread_create.c:297
#3  0x00007f6ee383652d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:112
#4  0x0000000000000000 in ?? ()

Thread 1 (Thread 0x7f6ee61f2760 (LWP 8369)):
[KCrash Handler]
#6  ref (this=0x498e0b0) at /usr/include/QtCore/qatomic_x86_64.h:121
#7  QString (this=0x498e0b0) at /usr/include/QtCore/qstring.h:729
#8  outputFile (this=0x498e0b0) at /usr/src/debug/kdepim-4.5.80/build/korganizer/htmlexportsettings.h:208
#9  KOrg::HtmlExportJob::finishExport (this=0x498e0b0) at /usr/src/debug/kdepim-4.5.80/korganizer/htmlexportjob.cpp:150
#10 0x00007f6ec9c6f173 in KOrg::HtmlExportJob::receivedOrganizerInfo (this=0x498e0b0, job=<value optimized out>) at /usr/src/debug/kdepim-4.5.80/korganizer/htmlexportjob.cpp:141
#11 0x00007f6ec9c6f3c0 in KOrg::HtmlExportJob::qt_metacall (this=0x498e0b0, _c=QMetaObject::InvokeMetaMethod, _id=<value optimized out>, _a=0x7fff75c63d10) at /usr/src/debug/kdepim-4.5.80/build/korganizer/htmlexportjob.moc:72
#12 0x00007f6ee4beadbf in QMetaObject::activate (sender=0x4c37680, m=<value optimized out>, local_signal_index=<value optimized out>, argv=0x7fff75c63d10) at kernel/qobject.cpp:3272
#13 0x00007f6ee4fca3b2 in KJob::result (this=<value optimized out>, _t1=0x4c37680) at /usr/src/debug/kdelibs-4.5.80/build/kdecore/kjob.moc:194
#14 0x00007f6ee4fca3f0 in KJob::emitResult (this=0x4c37680) at /usr/src/debug/kdelibs-4.5.80/kdecore/jobs/kjob.cpp:312
#15 0x00007f6ee0a4c64d in Akonadi::Job::qt_metacall (this=0x4c37680, _c=QMetaObject::InvokeMetaMethod, _id=<value optimized out>, _a=0x4c2cd20) at /usr/src/debug/kdepimlibs-4.5.80/build/akonadi/job.moc:91
#16 0x00007f6ee0a75655 in Akonadi::ItemSearchJob::qt_metacall (this=0x4c37680, _c=QMetaObject::InvokeMetaMethod, _id=<value optimized out>, _a=0x4c2cd20) at /usr/src/debug/kdepimlibs-4.5.80/build/akonadi/itemsearchjob.moc:72
#17 0x00007f6ee4be9a3a in QObject::event (this=0x4c37680, e=<value optimized out>) at kernel/qobject.cpp:1211
#18 0x00007f6ee3fa2d24 in QApplicationPrivate::notify_helper (this=0x63d290, receiver=0x4c37680, e=0xc1a3420) at kernel/qapplication.cpp:4445
#19 0x00007f6ee3fab21a in QApplication::notify (this=<value optimized out>, receiver=0x4c37680, e=0xc1a3420) at kernel/qapplication.cpp:4324
#20 0x00007f6ee55355a6 in KApplication::notify (this=0x7fff75c647d0, receiver=0x4c37680, event=0xc1a3420) at /usr/src/debug/kdelibs-4.5.80/kdeui/kernel/kapplication.cpp:311
#21 0x00007f6ee4bd5bac in QCoreApplication::notifyInternal (this=0x7fff75c647d0, receiver=0x4c37680, event=0xc1a3420) at kernel/qcoreapplication.cpp:732
#22 0x00007f6ee4bd93a5 in sendEvent (receiver=0x0, event_type=0, data=0x60d7f0) at kernel/qcoreapplication.h:215
#23 QCoreApplicationPrivate::sendPostedEvents (receiver=0x0, event_type=0, data=0x60d7f0) at kernel/qcoreapplication.cpp:1373
#24 0x00007f6ee4c00743 in sendPostedEvents (s=<value optimized out>) at kernel/qcoreapplication.h:220
#25 postEventSourceDispatch (s=<value optimized out>) at kernel/qeventdispatcher_glib.cpp:277
#26 0x00007f6edd30f2b3 in g_main_dispatch (context=0x63f320) at gmain.c:2267
#27 g_main_context_dispatch (context=0x63f320) at gmain.c:2824
#28 0x00007f6edd30fa90 in g_main_context_iterate (context=0x63f320, block=1, dispatch=1, self=<value optimized out>) at gmain.c:2902
#29 0x00007f6edd30fd30 in g_main_context_iteration (context=0x63f320, may_block=1) at gmain.c:2965
#30 0x00007f6ee4c008df in QEventDispatcherGlib::processEvents (this=0x613890, flags=<value optimized out>) at kernel/qeventdispatcher_glib.cpp:415
#31 0x00007f6ee4047d2e in QGuiEventDispatcherGlib::processEvents (this=<value optimized out>, flags=<value optimized out>) at kernel/qguieventdispatcher_glib.cpp:204
#32 0x00007f6ee4bd4fe2 in QEventLoop::processEvents (this=<value optimized out>, flags=...) at kernel/qeventloop.cpp:149
#33 0x00007f6ee4bd51f5 in QEventLoop::exec (this=0x7fff75c64720, flags=...) at kernel/qeventloop.cpp:201
#34 0x00007f6ee4bd965b in QCoreApplication::exec () at kernel/qcoreapplication.cpp:1009
#35 0x0000000000404037 in main (argc=1, argv=0x7fff75c64db8) at /usr/src/debug/kdepim-4.5.80/kontact/src/main.cpp:217

Reported using DrKonqi
Comment 1 Christophe Marin 2010-12-03 17:50:20 UTC
*** Bug 258670 has been marked as a duplicate of this bug. ***
Comment 2 Bruno Friedmann 2010-12-03 19:52:20 UTC
Created attachment 54058 [details]
New crash information added by DrKonqi

korganizer (4.6 pre- ()) on KDE Platform 4.5.80 (4.6 Beta1) using Qt 4.7.1

- What I was doing when the application crashed:

Ok this time I launch only korganizer alone to be sure it that component that crash.
As far I can remember the only thing I change after the 4.6 upgrade was activating the auto backup export in html
every 99 minutes, and that exactly the time after korganizer crash.
With the "ask for delete" checked

First question : why only 99 in the select box, and not 120 minutes ?

-- Backtrace (Reduced):
#6  ref (this=0x47bab70) at /usr/include/QtCore/qatomic_x86_64.h:121
#7  QString (this=0x47bab70) at /usr/include/QtCore/qstring.h:729
#8  outputFile (this=0x47bab70) at /usr/src/debug/kdepim-4.5.80/build/korganizer/htmlexportsettings.h:208
#9  KOrg::HtmlExportJob::finishExport (this=0x47bab70) at /usr/src/debug/kdepim-4.5.80/korganizer/htmlexportjob.cpp:150
#10 0x00007fe97807b173 in KOrg::HtmlExportJob::receivedOrganizerInfo (this=0x47bab70, job=<value optimized out>) at /usr/src/debug/kdepim-4.5.80/korganizer/htmlexportjob.cpp:141
Comment 3 Sergio Martins 2010-12-31 01:06:55 UTC
Can you get a valgrind report?

valgrind korganizer --nofork &> valgrind.out

and wait for it to crash, maybe try reducing the frequency from 99, to 1, so you make it crash quicker.

Can't reproduce with current master.
Comment 4 Sergio Martins 2010-12-31 01:52:57 UTC
commit 87b008b02edeab2ae50944eb29efe78e13e49c9d
branch master
Author: Sergio Martins <iamsergio@gmail.com>
Date:   Fri Dec 31 00:49:10 2010 +0000

    Not a good idea to pass a local variable reference to a class with async API.
    When the job finishes, the variable is already scoped out and destroyed.
    Fixes crash in HTML exporting.
    BUG: 258560

diff --git a/korganizer/actionmanager.cpp b/korganizer/actionmanager.cpp
index ab56443..fc2bd8d 100644
--- a/korganizer/actionmanager.cpp
+++ b/korganizer/actionmanager.cpp
@@ -40,7 +40,6 @@
 #include "kowindowlist.h"
 #include "reminderclient.h"
 #include "akonadicollectionview.h"
-#include "htmlexportjob.h"
 #include "htmlexportsettings.h"
 
 #include <KCalCore/FileStorage>
@@ -1180,27 +1179,28 @@ bool ActionManager::saveURL()
 
 void ActionManager::exportHTML()
 {
-  HTMLExportSettings settings( "KOrganizer" );
+  HTMLExportSettingsPtr settings( new HTMLExportSettings( "KOrganizer" ) );
   // Manually read in the config, because parametrized kconfigxt objects don't
   // seem to load the config theirselves
-  settings.readConfig();
+  settings->readConfig();
 
   const QDate qd1 = QDate::currentDate();
   QDate qd2 = qd1;
 
-  if ( settings.monthView() ) {
+  if ( settings->monthView() ) {
     qd2.addMonths( 1 );
   } else {
     qd2.addDays( 7 );
   }
-  settings.setDateStart( QDateTime( qd1 ) );
-  settings.setDateEnd( QDateTime( qd2 ) );
-  exportHTML( &settings );
+  settings->setDateStart( QDateTime( qd1 ) );
+  settings->setDateEnd( QDateTime( qd2 ) );
+  exportHTML( settings );
 }
 
-void ActionManager::exportHTML( KOrg::HTMLExportSettings *settings )
+void ActionManager::exportHTML( const KOrg::HTMLExportSettingsPtr &settings )
 {
   if ( !settings || settings->outputFile().isEmpty() ) {
+    kWarning() << "Settings is null, or the output file is empty " << settings.data();
     return;
   }
 
diff --git a/korganizer/actionmanager.h b/korganizer/actionmanager.h
index 0bc744f..07a7812 100644
--- a/korganizer/actionmanager.h
+++ b/korganizer/actionmanager.h
@@ -30,6 +30,7 @@
 
 #include "korganizer_export.h"
 #include "korganizer/part.h"
+#include "htmlexportjob.h"
 
 #include <KCalCore/Incidence>
 
@@ -127,7 +128,7 @@ class KORGANIZERPRIVATE_EXPORT ActionManager : public QObject
     bool saveAsURL( const KUrl &kurl );
 
     void exportHTML();
-    void exportHTML( KOrg::HTMLExportSettings * );
+    void exportHTML( const KOrg::HTMLExportSettingsPtr & );
     void toggleMenubar( bool dontShowWarning = false );
 
   public:
diff --git a/korganizer/htmlexportjob.cpp b/korganizer/htmlexportjob.cpp
index a599337..54e574e 100644
--- a/korganizer/htmlexportjob.cpp
+++ b/korganizer/htmlexportjob.cpp
@@ -54,11 +54,12 @@ using namespace KOrg;
 
 static QString cleanChars( const QString &txt );
 
+
 //@cond PRIVATE
 class KOrg::HtmlExportJob::Private
 {
   public:
-    Private( CalendarSupport::Calendar *calendar, KOrg::HTMLExportSettings *settings, QWidget *parent )
+    Private( CalendarSupport::Calendar *calendar, const HTMLExportSettingsPtr &settings, QWidget *parent )
       : mCalendar( calendar ),
         mSettings( settings ),
         mParentWidget( parent ),
@@ -66,7 +67,7 @@ class KOrg::HtmlExportJob::Private
     {}
 
     CalendarSupport::Calendar *mCalendar;
-    KOrg::HTMLExportSettings *mSettings;
+    HTMLExportSettingsPtr mSettings;
     QWidget *mParentWidget;
     QMap<QDate,QString> mHolidayMap;
     qulonglong mSubJobCount;
@@ -74,7 +75,7 @@ class KOrg::HtmlExportJob::Private
 };
 //@endcond
 
-HtmlExportJob::HtmlExportJob( CalendarSupport::Calendar *calendar, KOrg::HTMLExportSettings *settings, QWidget *parent )
+HtmlExportJob::HtmlExportJob( CalendarSupport::Calendar *calendar, const HTMLExportSettingsPtr &settings, QWidget *parent )
   : KJob( parent ), d( new Private( calendar, settings, parent ) )
 {
 }
diff --git a/korganizer/htmlexportjob.h b/korganizer/htmlexportjob.h
index a7927ca..aeb5aa9 100644
--- a/korganizer/htmlexportjob.h
+++ b/korganizer/htmlexportjob.h
@@ -24,13 +24,14 @@
 
 #include <kjob.h>
 
-#include <kcalcore/incidence.h>
-#include <kcalcore/event.h>
-#include <kcalcore/todo.h>
+#include <KCalCore/Incidence>
+#include <KCalCore/Event>
+#include <KCalCore/Todo>
 
 #include <QtCore/QDateTime>
 #include <QtCore/QString>
 #include <QtCore/QTextStream>
+#include <QSharedPointer>
 
 class QTextStream;
 
@@ -42,9 +43,10 @@ namespace CalendarSupport {
   class Calendar;
 }
 
-namespace KOrg {
 
+namespace KOrg {
 class HTMLExportSettings;
+typedef QSharedPointer<HTMLExportSettings> HTMLExportSettingsPtr;
 
 /**
   This class provides the functions to export a calendar as a HTML page.
@@ -57,7 +59,8 @@ class HtmlExportJob : public KJob
     /**
       Create new HTML exporter for calendar.
     */
-    HtmlExportJob( CalendarSupport::Calendar *calendar, HTMLExportSettings *settings, QWidget *parent = 0 );
+    HtmlExportJob( CalendarSupport::Calendar *calendar, const HTMLExportSettingsPtr &settings,
+                   QWidget *parent = 0 );
     virtual ~HtmlExportJob();
 
     void addHoliday( const QDate &date, const QString &name );