Show
Ignore:
Timestamp:
08/24/02 23:41:13 (6 years ago)
Author:
darin
Message:
  • fixed 3032072 -- Crash on reload in DOM::DocumentImpl::~DocumentImpl [unified]()

This was a tough one to debug.
Turned out to be a subtle bug in our new QConstString implementation.

  • kwq/KWQString.mm: (QStringData::makeAscii): Don't invalidate the Unicode buffer unless the ASCII buffer is taking over the internal buffer from the Unicode. In other cases, it's important not to invalidate the Unicode because it can result in the Unicode being freed and re-created when unicode() is called, which is disastrous in the QConstString case because we can't free the Unicode. (QStringData::makeUnicode): Make the corresponding change for ASCII too. In this case, it's just an optimization, not a bug fix. (QString::insert), (QString::remove), (QString::fill), (QString::operator+=): Mark the other string invalid whenever we modify either the ASCII or the Unicode string. This was handled correctly for some operations before, but not all, and it now matters because makeAscii and makeUnicode will now allow this state.

Fixed a separate QString problem; I think I may have introduced this one.

  • kwq/KWQString.mm: (QString::getNSString): Since by ASCII, we actually mean ISO Latin 1, we can't use [NSString stringWithCString:]. Use CFStringCreateWithCString instead, pass CFStringCreateWithCString as the encoding, and use autorelease. We shouldn't really use the term ASCII in this class for the 8-bit-per-character buffer. Something more like Latin1 would be a more accurate way to refer to it. Maybe I'll do that renaming after talking to Richard about it on Monday.

Fixed a small storage leak.

  • khtml/css/css_valueimpl.cpp: (CSSPrimitiveValueImpl::cleanup): Added braces to fix obviously-incorrect if/else grouping.
Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/WebCore/ChangeLog-2005-08-23

    r1910 r1912  
     12002-08-24  Darin Adler  <darin@apple.com> 
     2 
     3        - fixed 3032072 -- Crash on reload in DOM::DocumentImpl::~DocumentImpl [unified]() 
     4 
     5        This was a tough one to debug. 
     6        Turned out to be a subtle bug in our new QConstString implementation. 
     7 
     8        * kwq/KWQString.mm: 
     9        (QStringData::makeAscii): Don't invalidate the Unicode buffer unless the ASCII 
     10        buffer is taking over the internal buffer from the Unicode. In other cases, it's 
     11        important not to invalidate the Unicode because it can result in the Unicode being 
     12        freed and re-created when unicode() is called, which is disastrous in the QConstString 
     13        case because we can't free the Unicode. 
     14        (QStringData::makeUnicode): Make the corresponding change for ASCII too. In this 
     15        case, it's just an optimization, not a bug fix. 
     16        (QString::insert), (QString::remove), (QString::fill), (QString::operator+=): 
     17        Mark the other string invalid whenever we modify either the ASCII or the Unicode 
     18        string. This was handled correctly for some operations before, but not all, and it 
     19        now matters because makeAscii and makeUnicode will now allow this state. 
     20 
     21        Fixed a separate QString problem; I think I may have introduced this one. 
     22 
     23        * kwq/KWQString.mm: 
     24        (QString::getNSString): Since by ASCII, we actually mean ISO Latin 1, we can't use 
     25        [NSString stringWithCString:]. Use CFStringCreateWithCString instead, pass 
     26        CFStringCreateWithCString as the encoding, and use autorelease. We shouldn't really 
     27        use the term ASCII in this class for the 8-bit-per-character buffer. Something more 
     28        like Latin1 would be a more accurate way to refer to it. Maybe I'll do that renaming 
     29        after talking to Richard about it on Monday. 
     30 
     31        Fixed a small storage leak. 
     32 
     33        * khtml/css/css_valueimpl.cpp: (CSSPrimitiveValueImpl::cleanup): Added braces to 
     34        fix obviously-incorrect if/else grouping. 
     35 
    1362002-08-23  Darin Adler  <darin@apple.com> 
    237