Summary: | Crash after applying an event change | ||
---|---|---|---|
Product: | [Applications] korganizer | Reporter: | Jose Hernandez <code> |
Component: | general | Assignee: | Cornelius Schumacher <schumacher> |
Status: | RESOLVED FIXED | ||
Severity: | crash | CC: | dluebke, gritzko, thomas-ml, w.richert |
Priority: | NOR | ||
Version: | unspecified | ||
Target Milestone: | --- | ||
Platform: | unspecified | ||
OS: | Linux | ||
Latest Commit: | Version Fixed In: | ||
Attachments: | crash |
Description
Jose Hernandez
2004-01-12 05:37:02 UTC
Created attachment 4112 [details]
crash
*** Bug 72605 has been marked as a duplicate of this bug. *** *** Bug 73327 has been marked as a duplicate of this bug. *** *** Bug 73841 has been marked as a duplicate of this bug. *** *** Bug 73746 has been marked as a duplicate of this bug. *** *** Bug 74023 has been marked as a duplicate of this bug. *** Don't people look at existing bug reports anymore? This bug was reported six times. 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(); |