[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-bugs-dist
Subject:    [Bug 61213] Crash when selecting old messages
From:       Martin Hignett <martin () hignett ! clara ! co ! uk>
Date:       2003-07-20 17:30:25
[Download RAW message or body]

------- 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=61213     




------- Additional Comments From martin@hignett.clara.co.uk  2003-07-20 19:30 -------
Okay, I've spotted the problem... 
 
[New Thread 16384 (LWP 20672)] 
<...> 
#9  0x41bb09b2 in __assert_fail () from /lib/libc.so.6 
#10 0x40637cf4 in DwString (this=0xbfffe4b0, aFile=0x0, aLen=4725) 
    at dwstring.cpp:331 
#11 0x081c1d12 in KMFolderMaildir::getDwString(int) (this=0x841aec0, idx=7) 
    at kmfoldermaildir.cpp:500 
#12 0x081c1b9f in KMFolderMaildir::readMsg(int) (this=0x841aec0, idx=7) 
    at kmfoldermaildir.cpp:486 
#13 0x0813ca2e in KMFolder::getMsg(int) (this=0x841aec0, idx=7) 
    at kmfolder.cpp:520 
#14 0x08260067 in KMHeaders::highlightMessage(QListViewItem*, bool) ( 
    this=0x8428888, lvi=0x85d3398, markitread=false) at kmheaders.cpp:1952 
<...> 
 
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. 
 
Hope that helps!
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic