Skip to content

Commit

Permalink
* 修复关闭页面时候可能的崩溃
Browse files Browse the repository at this point in the history
  • Loading branch information
weolar committed Dec 6, 2019
1 parent f7087bc commit 7fb5d51
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
3 changes: 3 additions & 0 deletions content/browser/WebPageImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,13 +89,16 @@ void WebPageImpl::initBlink()

void WebPageImpl::registerDestroyNotif(DestroyNotif* destroyNotif)
{
WTF::Locker<WTF::Mutex> locker(m_destroyNotifsMutex);
size_t pos = m_destroyNotifs.find(destroyNotif);
if (WTF::kNotFound == pos)
m_destroyNotifs.append(destroyNotif);
}

void WebPageImpl::unregisterDestroyNotif(DestroyNotif* destroyNotif)
{
RELEASE_ASSERT(WTF::isMainThread());
WTF::Locker<WTF::Mutex> locker(m_destroyNotifsMutex);
size_t pos = m_destroyNotifs.find(destroyNotif);
if (WTF::kNotFound != pos)
m_destroyNotifs.remove(pos);
Expand Down
1 change: 1 addition & 0 deletions content/browser/WebPageImpl.h
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,7 @@ class WebPageImpl
bool m_postCloseWidgetSoonMessage;

WTF::Vector<DestroyNotif*> m_destroyNotifs;
WTF::Mutex m_destroyNotifsMutex;
HRGN m_draggableRegion;

HWND m_popupHandle;
Expand Down

0 comments on commit 7fb5d51

Please sign in to comment.