diff --git a/libcef/dom_document_impl.cc b/libcef/dom_document_impl.cc index c6f84cf1c..f3cf10808 100644 --- a/libcef/dom_document_impl.cc +++ b/libcef/dom_document_impl.cc @@ -255,6 +255,14 @@ void CefDOMDocumentImpl::Detach() if (!VerifyContext()) return; + // If you hit this assert it means that you are keeping references to node + // objects beyond the valid scope. + DCHECK(node_map_.empty()); + + // If you hit this assert it means that you are keeping references to this + // document object beyond the valid scope. + DCHECK(GetRefCt() == 1); + if (!node_map_.empty()) { NodeMap::const_iterator it = node_map_.begin(); for (; it != node_map_.end(); ++it) diff --git a/libcef/dom_event_impl.cc b/libcef/dom_event_impl.cc index f7db2fb8c..7dc7ffef6 100644 --- a/libcef/dom_event_impl.cc +++ b/libcef/dom_event_impl.cc @@ -147,6 +147,10 @@ CefRefPtr CefDOMEventImpl::GetCurrentTarget() void CefDOMEventImpl::Detach() { + // If you hit this assert it means that you are keeping references to this + // event object beyond the valid scope. + DCHECK(GetRefCt() == 1); + document_ = NULL; event_.assign(WebDOMEvent()); }