Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-cw
Commits
ea0ebbfe
Commit
ea0ebbfe
authored
Nov 24, 2011
by
Jacek Caban
Committed by
Alexandre Julliard
Nov 24, 2011
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mshtml: Properly remove event listeners.
parent
66520ea0
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
47 additions
and
1 deletion
+47
-1
htmldoc.c
dlls/mshtml/htmldoc.c
+1
-0
htmlevent.c
dlls/mshtml/htmlevent.c
+14
-0
htmlevent.h
dlls/mshtml/htmlevent.h
+2
-0
htmlwindow.c
dlls/mshtml/htmlwindow.c
+1
-0
nsevents.c
dlls/mshtml/nsevents.c
+29
-1
No files found.
dlls/mshtml/htmldoc.c
View file @
ea0ebbfe
...
...
@@ -2032,6 +2032,7 @@ static void HTMLDocumentNode_destructor(HTMLDOMNode *iface)
heap_free
(
This
->
elem_vars
[
i
]);
heap_free
(
This
->
elem_vars
);
detach_events
(
This
);
if
(
This
->
body_event_target
)
release_event_target
(
This
->
body_event_target
);
if
(
This
->
nsevent_listener
)
...
...
dlls/mshtml/htmlevent.c
View file @
ea0ebbfe
...
...
@@ -1184,6 +1184,20 @@ static HRESULT ensure_nsevent_handler(HTMLDocumentNode *doc, event_target_t *eve
return
S_OK
;
}
void
detach_events
(
HTMLDocumentNode
*
doc
)
{
int
i
;
if
(
!
doc
->
event_vector
)
return
;
for
(
i
=
0
;
i
<
EVENTID_LAST
;
i
++
)
{
if
(
doc
->
event_vector
[
i
])
detach_nsevent
(
doc
,
event_info
[
i
].
name
);
}
}
static
HRESULT
remove_event_handler
(
event_target_t
**
event_target
,
eventid_t
eid
)
{
if
(
*
event_target
&&
(
*
event_target
)
->
event_table
[
eid
]
&&
(
*
event_target
)
->
event_table
[
eid
]
->
handler_prop
)
{
...
...
dlls/mshtml/htmlevent.h
View file @
ea0ebbfe
...
...
@@ -54,10 +54,12 @@ HRESULT dispatch_event(HTMLDOMNode*,const WCHAR*,VARIANT*,VARIANT_BOOL*) DECLSPE
HRESULT
call_fire_event
(
HTMLDOMNode
*
,
eventid_t
)
DECLSPEC_HIDDEN
;
void
update_cp_events
(
HTMLWindow
*
,
event_target_t
**
,
cp_static_data_t
*
,
nsIDOMNode
*
)
DECLSPEC_HIDDEN
;
HRESULT
doc_init_events
(
HTMLDocumentNode
*
)
DECLSPEC_HIDDEN
;
void
detach_events
(
HTMLDocumentNode
*
doc
)
DECLSPEC_HIDDEN
;
void
init_nsevents
(
HTMLDocumentNode
*
)
DECLSPEC_HIDDEN
;
void
release_nsevents
(
HTMLDocumentNode
*
)
DECLSPEC_HIDDEN
;
void
add_nsevent_listener
(
HTMLDocumentNode
*
,
nsIDOMNode
*
,
LPCWSTR
)
DECLSPEC_HIDDEN
;
void
detach_nsevent
(
HTMLDocumentNode
*
,
const
WCHAR
*
)
DECLSPEC_HIDDEN
;
static
inline
event_target_t
**
get_node_event_target
(
HTMLDOMNode
*
node
)
{
...
...
dlls/mshtml/htmlwindow.c
View file @
ea0ebbfe
...
...
@@ -46,6 +46,7 @@ static void window_set_docnode(HTMLWindow *window, HTMLDocumentNode *doc_node)
if
(
window
->
doc
)
{
if
(
window
->
doc_obj
&&
window
==
window
->
doc_obj
->
basedoc
.
window
)
window
->
doc
->
basedoc
.
cp_container
.
forward_container
=
NULL
;
detach_events
(
window
->
doc
);
abort_document_bindings
(
window
->
doc
);
window
->
doc
->
basedoc
.
window
=
NULL
;
htmldoc_release
(
&
window
->
doc
->
basedoc
);
...
...
dlls/mshtml/nsevents.c
View file @
ea0ebbfe
...
...
@@ -281,7 +281,7 @@ static nsresult NSAPI handle_htmlevent(nsIDOMEventListener *iface, nsIDOMEvent *
eventid_t
eid
;
nsresult
nsres
;
TRACE
(
"
\n
"
);
TRACE
(
"
%p
\n
"
,
This
->
This
);
nsAString_Init
(
&
type_str
,
NULL
);
nsIDOMEvent_GetType
(
event
,
&
type_str
);
...
...
@@ -363,8 +363,34 @@ void add_nsevent_listener(HTMLDocumentNode *doc, nsIDOMNode *nsnode, LPCWSTR typ
nsIDOMEventTarget_Release
(
target
);
}
void
detach_nsevent
(
HTMLDocumentNode
*
doc
,
const
WCHAR
*
type
)
{
nsIDOMEventTarget
*
target
;
nsAString
type_str
;
nsresult
nsres
;
if
(
!
doc
->
basedoc
.
window
)
return
;
nsres
=
nsIDOMWindow_QueryInterface
(
doc
->
basedoc
.
window
->
nswindow
,
&
IID_nsIDOMEventTarget
,
(
void
**
)
&
target
);
if
(
NS_FAILED
(
nsres
))
{
ERR
(
"Could not get nsIDOMEventTarget interface: %08x
\n
"
,
nsres
);
return
;
}
nsAString_InitDepend
(
&
type_str
,
type
);
nsres
=
nsIDOMEventTarget_RemoveEventListener
(
target
,
&
type_str
,
&
doc
->
nsevent_listener
->
htmlevent_listener
.
nsIDOMEventListener_iface
,
TRUE
);
nsAString_Finish
(
&
type_str
);
nsIDOMEventTarget_Release
(
target
);
if
(
NS_FAILED
(
nsres
))
ERR
(
"RemoveEventTarget failed: %08x
\n
"
,
nsres
);
}
void
release_nsevents
(
HTMLDocumentNode
*
doc
)
{
TRACE
(
"%p %p
\n
"
,
doc
,
doc
->
nsevent_listener
);
if
(
doc
->
nsevent_listener
)
{
doc
->
nsevent_listener
->
doc
=
NULL
;
release_listener
(
doc
->
nsevent_listener
);
...
...
@@ -387,6 +413,8 @@ void init_nsevents(HTMLDocumentNode *doc)
if
(
!
listener
)
return
;
TRACE
(
"%p %p
\n
"
,
doc
,
listener
);
listener
->
ref
=
1
;
listener
->
doc
=
doc
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment