Bug 72445 - Crash after applying an event change
Summary: Crash after applying an event change
Status: RESOLVED FIXED
Alias: None
Product: korganizer
Classification: Applications
Component: general (show other bugs)
Version: unspecified
Platform: unspecified Linux
: NOR crash
Target Milestone: ---
Assignee: Cornelius Schumacher
URL:
Keywords:
: 72605 73327 73746 73841 74023 (view as bug list)
Depends on:
Blocks:
 
Reported: 2004-01-12 05:37 UTC by Jose Hernandez
Modified: 2004-02-07 01:16 UTC (History)
4 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
crash (2.39 KB, text/plain)
2004-01-12 05:37 UTC, Jose Hernandez
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Jose Hernandez 2004-01-12 05:37:02 UTC
Version:           3.2 (using KDE 3.1.94 (CVS >= 20031206), compiled sources)
Compiler:          gcc version 3.2.3 20030422 (Gentoo Linux 1.4 3.2.3-r3, propolice)
OS:          Linux (i686) release 2.6.0-gentoo

KOrganizer crashed randomly after applying a change to an event with an alarm. Attaching crash output --debug=full.
Comment 1 Jose Hernandez 2004-01-12 05:37:50 UTC
Created attachment 4112 [details]
crash
Comment 2 Cornelius Schumacher 2004-02-07 00:50:17 UTC
*** Bug 72605 has been marked as a duplicate of this bug. ***
Comment 3 Cornelius Schumacher 2004-02-07 00:52:25 UTC
*** Bug 73327 has been marked as a duplicate of this bug. ***
Comment 4 Cornelius Schumacher 2004-02-07 00:55:13 UTC
*** Bug 73841 has been marked as a duplicate of this bug. ***
Comment 5 Cornelius Schumacher 2004-02-07 00:55:42 UTC
*** Bug 73746 has been marked as a duplicate of this bug. ***
Comment 6 Cornelius Schumacher 2004-02-07 00:56:17 UTC
*** Bug 74023 has been marked as a duplicate of this bug. ***
Comment 7 Cornelius Schumacher 2004-02-07 00:58:03 UTC
Don't people look at existing bug reports anymore? This bug was reported six times.
Comment 8 Cornelius Schumacher 2004-02-07 01:16:27 UTC
Subject: KDE_3_2_BRANCH: kdepim/libkcal

CVS commit by cschumac: 

Don't reload calendar calendar file, when it didn't change. The problem
was that after a save the file immediately was reloaded which invalidated
all Event pointers causing a crash in the event editor which holds a
pointer to the event being edited.

CCMAIL: 72445-done@bugs.kde.org


  M +1 -1      calendarlocal.cpp   1.54.2.1
  M +3 -3      compat.cpp   1.5.6.1
  M +3 -1      icalformatimpl.cpp   1.96.4.1
  M +35 -3     resourcelocal.cpp   1.19.6.1
  M +2 -0      resourcelocal.h   1.13.4.1


--- kdepim/libkcal/calendarlocal.cpp  #1.54:1.54.2.1
@@ -115,5 +115,5 @@ void CalendarLocal::deleteAllEvents()
 Event *CalendarLocal::event( const QString &uid )
 {
-  kdDebug(5800) << "CalendarLocal::event(): " << uid << endl;
+//  kdDebug(5800) << "CalendarLocal::event(): " << uid << endl;
   return mEvents[ uid ];
 }

--- kdepim/libkcal/compat.cpp  #1.5:1.5.6.1
@@ -44,5 +44,5 @@ Compat *CompatFactory::createCompat( con
         QString version = productId.mid( versionStart + 1,
                                          versionStop - versionStart - 1 );
-        kdDebug(5800) << "Found KOrganizer version: " << version << endl;
+//        kdDebug(5800) << "Found KOrganizer version: " << version << endl;
         
         int versionNum = version.section( ".", 0, 0 ).toInt() * 10000 +
@@ -54,7 +54,7 @@ Compat *CompatFactory::createCompat( con
           release = productId.mid( versionStop+1, releaseStop-versionStop-1 );
         }
-        kdDebug(5800) << "KOrganizer release: \"" << release << "\"" << endl;
+//        kdDebug(5800) << "KOrganizer release: \"" << release << "\"" << endl;
                          
-        kdDebug(5800) << "Numerical version: " << versionNum << endl;
+//        kdDebug(5800) << "Numerical version: " << versionNum << endl;
         
         if ( versionNum < 30100 ) {

--- kdepim/libkcal/icalformatimpl.cpp  #1.96:1.96.4.1
@@ -401,6 +401,8 @@ icalcomponent *ICalFormatImpl::writeTodo
 icalcomponent *ICalFormatImpl::writeEvent(Event *event)
 {
+#if 0
   kdDebug(5800) << "Write Event '" << event->summary() << "' (" << event->uid()
               << ")" << endl;
+#endif
 
   QString tmpStr;

--- kdepim/libkcal/resourcelocal.cpp  #1.19:1.19.6.1
@@ -50,4 +50,10 @@
 using namespace KCal;
 
+class ResourceLocal::Private
+{
+  public:
+    QDateTime mLastModified;
+};
+
 ResourceLocal::ResourceLocal( const KConfig* config )
   : ResourceCached( config ), mLock( 0 )
@@ -99,4 +105,6 @@ void ResourceLocal::writeConfig( KConfig
 void ResourceLocal::init()
 {
+  d = new ResourceLocal::Private;
+
   setType( "file" );
 
@@ -122,4 +130,6 @@ ResourceLocal::~ResourceLocal()
 
   delete mLock;
+
+  delete d;
 }
 
@@ -133,9 +143,19 @@ bool ResourceLocal::doOpen()
 }
 
+QDateTime ResourceLocal::readLastModified()
+{
+  QFileInfo fi( mURL.path() );
+  return fi.lastModified();
+}
+
 bool ResourceLocal::load()
 {
   if ( !mOpen ) return true;
   
-  return mCalendar.load( mURL.path() );
+  bool success = mCalendar.load( mURL.path() );
+
+  d->mLastModified = readLastModified();
+
+  return success;
 }
 
@@ -144,5 +164,9 @@ bool ResourceLocal::save()
   if ( !mOpen ) return true;
 
-  return mCalendar.save( mURL.path() );
+  bool success = mCalendar.save( mURL.path() );
+
+  d->mLastModified = readLastModified();
+
+  return success;
 }
 
@@ -154,6 +178,14 @@ KABC::Lock *ResourceLocal::lock()
 void ResourceLocal::reload()
 {
+  kdDebug(5800) << "ResourceLocal::reload()" << endl;
+
   if ( !mOpen ) return;
 
+  if ( d->mLastModified == readLastModified() ) {
+    kdDebug(5800) << "ResourceLocal::reload(): file not modified since last read."
+              << endl;
+    return;
+  }
+
   mCalendar.close();
   mCalendar.load( mURL.path() );

--- kdepim/libkcal/resourcelocal.h  #1.13:1.13.4.1
@@ -84,4 +84,6 @@ class ResourceLocal : public ResourceCac
     virtual void update( IncidenceBase *incidence );
  
+    QDateTime readLastModified();
+ 
   private:
     void init();