Changeset 51980 in webkit


Ignore:
Timestamp:
Dec 11, 2009 4:20:43 AM (14 years ago)
Author:
benm@google.com
Message:

[Android] Add detachHistoryItem() to AndroidWebHistoryBridge. And the constructor takes
HistoryItem* now. As AndroidWebHistoryBridge holds a dumb pointer of HistoryItem and
HistoryItem holds a RefPtr of AndroidWebHistoryBridge, the dumb pointer needs to be cleared
when HistoryItem is deleted to avoid potential crash.
https://bugs.webkit.org/show_bug.cgi?id=32251

Patch by Grace Kloba <klobag@gmail.com> on 2009-12-11
Reviewed by Darin Adler.

  • history/HistoryItem.cpp:

(WebCore::HistoryItem::~HistoryItem):

  • history/android/AndroidWebHistoryBridge.h:

(WebCore::AndroidWebHistoryBridge::AndroidWebHistoryBridge):
(WebCore::AndroidWebHistoryBridge::detachHistoryItem):

Location:
trunk/WebCore
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebCore/ChangeLog

    r51979 r51980  
     12009-12-11  Grace Kloba  <klobag@gmail.com>
     2
     3        Reviewed by Darin Adler.
     4
     5        [Android] Add detachHistoryItem() to AndroidWebHistoryBridge. And the constructor takes
     6        HistoryItem* now. As AndroidWebHistoryBridge holds a dumb pointer of HistoryItem and
     7        HistoryItem holds a RefPtr of AndroidWebHistoryBridge, the dumb pointer needs to be cleared
     8        when HistoryItem is deleted to avoid potential crash.
     9        https://bugs.webkit.org/show_bug.cgi?id=32251
     10
     11        * history/HistoryItem.cpp:
     12        (WebCore::HistoryItem::~HistoryItem):
     13        * history/android/AndroidWebHistoryBridge.h:
     14        (WebCore::AndroidWebHistoryBridge::AndroidWebHistoryBridge):
     15        (WebCore::AndroidWebHistoryBridge::detachHistoryItem):
     16
     17
    1182009-12-11  Fumitoshi Ukai  <ukai@chromium.org>
    219
  • trunk/WebCore/history/HistoryItem.cpp

    r51796 r51980  
    103103    ASSERT(!m_document);
    104104    iconDatabase()->releaseIconForPageURL(m_urlString);
     105#if PLATFORM(ANDROID)
     106    if (m_bridge)
     107        m_bridge->detachHistoryItem();
     108#endif
    105109}
    106110
  • trunk/WebCore/history/android/AndroidWebHistoryBridge.h

    r51628 r51980  
    3535class AndroidWebHistoryBridge : public RefCounted<AndroidWebHistoryBridge> {
    3636public:
    37     AndroidWebHistoryBridge()
     37    AndroidWebHistoryBridge(HistoryItem* item)
    3838        : m_scale(100)
    3939        , m_screenWidthScale(100)
    4040        , m_active(false)
    41         , m_historyItem(0) { }
     41        , m_historyItem(item) { }
    4242    virtual ~AndroidWebHistoryBridge() { }
    4343    virtual void updateHistoryItem(HistoryItem* item) = 0;
     
    4747    int scale() const { return m_scale; }
    4848    int screenWidthScale() const { return m_screenWidthScale; }
     49    void detachHistoryItem() { m_historyItem = 0; }
    4950    HistoryItem* historyItem() const { return m_historyItem; }
    5051    void setActive() { m_active = true; }
Note: See TracChangeset for help on using the changeset viewer.