[Bug 50462] mail is permanently lost if disk is full
Martin Koller
m.koller at surfeu.at
Mon Apr 16 17:06:56 UTC 2007
------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.
http://bugs.kde.org/show_bug.cgi?id=50462
m.koller surfeu at changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution| |FIXED
------- Additional Comments From m.koller surfeu at 2007-04-16 19:06 -------
SVN commit 654636 by mkoller:
BUG: 50462
I dare to close this bug report with this commit.
It basically automatically recreates the index whenever a "should never
happen" situation occurs in getting data from the index and retries to get
the requested information.
I hope it works as advertised ;-)
M +12 -0 kmfolderindex.cpp
M +2 -0 kmfolderindex.h
M +14 -2 kmmsgbase.cpp
--- branches/KDE/3.5/kdepim/kmail/kmfolderindex.cpp #654635:654636
@ -479,4 +479,16 @
return msgInfo;
}
+void KMFolderIndex::recreateIndex()
+{
+ kapp->setOverrideCursor(KCursor::arrowCursor());
+ KMessageBox::error(0,
+ i18n("The mail index for '%1' is corrupted and will be regenerated now, "
+ "but some information, including status flags, will be lost.").arg(name()));
+ kapp->restoreOverrideCursor();
+ createIndexFromContents();
+ readIndex();
+}
+
+
#include "kmfolderindex.moc"
--- branches/KDE/3.5/kdepim/kmail/kmfolderindex.h #654635:654636
@ -80,6 +80,8 @
virtual QString indexLocation() const;
virtual int writeIndex( bool createEmptyIndex = false );
+ void recreateIndex();
+
public slots:
/** Incrementally update the index if possible else call writeIndex */
virtual int updateIndex();
--- branches/KDE/3.5/kdepim/kmail/kmmsgbase.cpp #654635:654636
@ -1109,6 +1109,7 @
//-----------------------------------------------------------------------------
QString KMMsgBase::getStringPart(MsgPartType t) const
{
+retry:
QString ret;
g_chunk_offset = 0;
@ -1145,7 +1146,12 @
type = (MsgPartType) tmp;
if(g_chunk_offset + l > mIndexLength) {
kdDebug(5006) << "This should never happen.. " << __FILE__ << ":" << __LINE__ << endl;
- break;
+ if(using_mmap) {
+ g_chunk_length = 0;
+ g_chunk = 0;
+ }
+ storage()->recreateIndex();
+ goto retry;
}
if(type == t) {
// This works because the QString constructor does a memcpy.
@ -1178,6 +1184,7 @
//-----------------------------------------------------------------------------
off_t KMMsgBase::getLongPart(MsgPartType t) const
{
+retry:
off_t ret = 0;
g_chunk_offset = 0;
@ -1217,7 +1224,12 @
if (g_chunk_offset + l > mIndexLength) {
kdDebug(5006) << "This should never happen.. " << __FILE__ << ":" << __LINE__ << endl;
- break;
+ if(using_mmap) {
+ g_chunk_length = 0;
+ g_chunk = 0;
+ }
+ storage()->recreateIndex();
+ goto retry;
}
if(type == t) {
assert(sizeOfLong == l);
More information about the pkg-kde-bugs-fwd
mailing list