Skip to content

Commit

Permalink
Stop using CheckedRef with HistoryItem
Browse files Browse the repository at this point in the history
https://bugs.webkit.org/show_bug.cgi?id=266459

Reviewed by Ryosuke Niwa.

Stop using CheckedRef with HistoryItem. Use WeakRef instead to generate
more actionable crashes.

* Source/WebCore/history/HistoryItem.cpp:
(WebCore::HistoryItem::HistoryItem):
* Source/WebCore/history/HistoryItem.h:
* Source/WebKitLegacy/mac/History/WebHistoryItem.mm:

Canonical link: https://commits.webkit.org/272125@main
  • Loading branch information
cdumez committed Dec 15, 2023
1 parent abebb37 commit e523b9d
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Source/WebCore/history/HistoryItem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ HistoryItem::~HistoryItem()

HistoryItem::HistoryItem(const HistoryItem& item)
: RefCounted<HistoryItem>()
, CanMakeCheckedPtr()
, CanMakeWeakPtr<HistoryItem>()
, m_urlString(item.m_urlString)
, m_originalURLString(item.m_originalURLString)
, m_referrer(item.m_referrer)
Expand Down
4 changes: 2 additions & 2 deletions Source/WebCore/history/HistoryItem.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@
#include "PolicyContainer.h"
#include "SerializedScriptValue.h"
#include <memory>
#include <wtf/CheckedRef.h>
#include <wtf/RefCounted.h>
#include <wtf/WeakPtr.h>
#include <wtf/text/WTFString.h>

#if PLATFORM(IOS_FAMILY)
Expand Down Expand Up @@ -67,7 +67,7 @@ class HistoryItemClient : public RefCounted<HistoryItemClient> {
HistoryItemClient() = default;
};

class HistoryItem : public RefCounted<HistoryItem>, public CanMakeCheckedPtr {
class HistoryItem : public RefCounted<HistoryItem>, public CanMakeWeakPtr<HistoryItem> {
friend class BackForwardCache;

public:
Expand Down
2 changes: 1 addition & 1 deletion Source/WebKitLegacy/mac/History/WebHistoryItem.mm
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ @implementation WebHistoryItemPrivate

@end

using HistoryItemMap = HashMap<CheckedRef<HistoryItem>, WebHistoryItem*>;
using HistoryItemMap = HashMap<WeakRef<HistoryItem>, WebHistoryItem*>;

static inline WebCoreHistoryItem* core(WebHistoryItemPrivate* itemPrivate)
{
Expand Down

0 comments on commit e523b9d

Please sign in to comment.