------- You are receiving this mail because: ------- You are the assignee for the bug, or are watching the assignee. http://bugs.kde.org/show_bug.cgi?id=61213 sanders@kde.org changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |RESOLVED Resolution| |FIXED ------- Additional Comments From sanders@kde.org 2003-07-21 08:10 ------- Subject: Re: Crash when selecting old messages On Monday 21 July 2003 03:30, Martin Hignett wrote: ... > A quick look at line 500 in kmfoldermaildir.cpp reveals that a file > handle is being used wiithout first checking if its valid. A > simple if( stream != NULL ) sanity check should stop the crash. > I changed the code to the following: > > if (QFile::exists(abs_file)) > { > FILE* stream = fopen(abs_file.local8Bit(), "r+"); > if( stream != NULL ) > { > DwString str( stream, mi->msgSize() ); > fclose( stream ); > return str; > } > else > { > kdDebug( ) << "Could not open file" << abs_file << endl; > } > > And got the following output in stderr: > > <...> > kmail: Could not open > file/home/martin/Mail/inbox/cur/1029260564.1016.jTMR:2,S kmail: > (621, last 620) > kmail: set Msg, force = false > ASSERT: debug output not ended with \n > > That file exists, but with read only permisions, so that would > appear to be the problem! An ideal solution would be to fix the > problem either automaticaly or with user confirmation. Thanks a lot for that fix, it's very kind. I submitted the following form of it: DwString KMFolderMaildir::getDwString(int idx) { KMMsgInfo* mi = (KMMsgInfo*)mMsgList[idx]; QString abs_file(location() + "/cur/"); abs_file += mi->fileName(); QFileInfo fi( abs_file ); if (fi.exists() && fi.isFile() && fi.isWritable()) { FILE* stream = fopen(abs_file.local8Bit(), "r+"); DwString str( stream, mi->msgSize() ); fclose( stream ); return str; } kdDebug(5006) << "Could not open file r+" << abs_file << endl; return DwString(); } Please tell me if that doesn't work for you. Don. ------- Additional Comments From sanders@kde.org 2003-07-21 08:10 ------- Subject: Re: Crash when selecting old messages On Monday 21 July 2003 03:30, Martin Hignett wrote: ... > A quick look at line 500 in kmfoldermaildir.cpp reveals that a file > handle is being used wiithout first checking if its valid. A > simple if( stream != NULL ) sanity check should stop the crash. > I changed the code to the following: > > if (QFile::exists(abs_file)) > { > FILE* stream = fopen(abs_file.local8Bit(), "r+"); > if( stream != NULL ) > { > DwString str( stream, mi->msgSize() ); > fclose( stream ); > return str; > } > else > { > kdDebug( ) << "Could not open file" << abs_file << endl; > } > > And got the following output in stderr: > > <...> > kmail: Could not open > file/home/martin/Mail/inbox/cur/1029260564.1016.jTMR:2,S kmail: > (621, last 620) > kmail: set Msg, force = false > ASSERT: debug output not ended with \n > > That file exists, but with read only permisions, so that would > appear to be the problem! An ideal solution would be to fix the > problem either automaticaly or with user confirmation. Thanks a lot for that fix, it's very kind. I submitted the following form of it: DwString KMFolderMaildir::getDwString(int idx) { KMMsgInfo* mi = (KMMsgInfo*)mMsgList[idx]; QString abs_file(location() + "/cur/"); abs_file += mi->fileName(); QFileInfo fi( abs_file ); if (fi.exists() && fi.isFile() && fi.isWritable()) { FILE* stream = fopen(abs_file.local8Bit(), "r+"); DwString str( stream, mi->msgSize() ); fclose( stream ); return str; } kdDebug(5006) << "Could not open file r+" << abs_file << endl; return DwString(); } Please tell me if that doesn't work for you. Don. _______________________________________________ KMail Developers mailing list kmail@mail.kde.org http://mail.kde.org/mailman/listinfo/kmail