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
72ee409e
Commit
72ee409e
authored
Feb 13, 2017
by
Jacek Caban
Committed by
Alexandre Julliard
Feb 14, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mshtml: Don't reallocate handler_vector_t when handlers are added.
Signed-off-by:
Jacek Caban
<
jacek@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
c12b4b48
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
22 deletions
+18
-22
htmlevent.c
dlls/mshtml/htmlevent.c
+18
-22
No files found.
dlls/mshtml/htmlevent.c
View file @
72ee409e
...
...
@@ -38,7 +38,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(mshtml);
typedef
struct
{
IDispatch
*
handler_prop
;
DWORD
handler_cnt
;
IDispatch
*
handlers
[
0
]
;
IDispatch
*
*
handlers
;
}
handler_vector_t
;
struct
event_target_t
{
...
...
@@ -1315,25 +1315,13 @@ HRESULT call_fire_event(HTMLDOMNode *node, eventid_t eid)
return
S_OK
;
}
static
BOOL
alloc_handler_vector
(
event_target_t
*
event_target
,
eventid_t
eid
,
int
cnt
)
static
BOOL
alloc_handler_vector
(
event_target_t
*
event_target
,
eventid_t
eid
)
{
handler_vector_t
*
new_vector
,
*
handler_vector
=
event_target
->
event_table
[
eid
];
if
(
event_target
->
event_table
[
eid
])
return
TRUE
;
if
(
handler_vector
)
{
if
(
cnt
<=
handler_vector
->
handler_cnt
)
return
TRUE
;
new_vector
=
heap_realloc_zero
(
handler_vector
,
sizeof
(
handler_vector_t
)
+
sizeof
(
IDispatch
*
)
*
cnt
);
}
else
{
new_vector
=
heap_alloc_zero
(
sizeof
(
handler_vector_t
)
+
sizeof
(
IDispatch
*
)
*
cnt
);
}
if
(
!
new_vector
)
return
FALSE
;
new_vector
->
handler_cnt
=
cnt
;
event_target
->
event_table
[
eid
]
=
new_vector
;
return
TRUE
;
event_target
->
event_table
[
eid
]
=
heap_alloc_zero
(
sizeof
(
*
event_target
->
event_table
[
eid
]));
return
event_target
->
event_table
[
eid
]
!=
NULL
;
}
HRESULT
ensure_doc_nsevent_handler
(
HTMLDocumentNode
*
doc
,
eventid_t
eid
)
...
...
@@ -1433,7 +1421,7 @@ static HRESULT set_event_handler_disp(EventTarget *event_target, eventid_t eid,
return
E_OUTOFMEMORY
;
if
(
!
data
->
event_table
[
eid
])
{
if
(
!
alloc_handler_vector
(
data
,
eid
,
0
))
if
(
!
alloc_handler_vector
(
data
,
eid
))
return
E_OUTOFMEMORY
;
bind_event
(
event_target
,
eid
);
...
...
@@ -1536,13 +1524,21 @@ HRESULT attach_event(EventTarget *event_target, BSTR name, IDispatch *disp, VARI
if
(
data
->
event_table
[
eid
])
{
while
(
i
<
data
->
event_table
[
eid
]
->
handler_cnt
&&
data
->
event_table
[
eid
]
->
handlers
[
i
])
i
++
;
if
(
i
==
data
->
event_table
[
eid
]
->
handler_cnt
&&
!
alloc_handler_vector
(
data
,
eid
,
i
+
1
))
return
E_OUTOFMEMORY
;
}
else
if
(
alloc_handler_vector
(
data
,
eid
,
i
+
1
))
{
}
else
if
(
alloc_handler_vector
(
data
,
eid
))
{
bind_event
(
event_target
,
eid
);
}
else
{
return
E_OUTOFMEMORY
;
}
if
(
i
==
data
->
event_table
[
eid
]
->
handler_cnt
)
{
if
(
i
)
data
->
event_table
[
eid
]
->
handlers
=
heap_realloc_zero
(
data
->
event_table
[
eid
]
->
handlers
,
(
i
+
1
)
*
sizeof
(
*
data
->
event_table
[
eid
]
->
handlers
));
else
data
->
event_table
[
eid
]
->
handlers
=
heap_alloc_zero
(
sizeof
(
*
data
->
event_table
[
eid
]
->
handlers
));
if
(
!
data
->
event_table
[
eid
]
->
handlers
)
return
E_OUTOFMEMORY
;
data
->
event_table
[
eid
]
->
handler_cnt
++
;
}
IDispatch_AddRef
(
disp
);
data
->
event_table
[
eid
]
->
handlers
[
i
]
=
disp
;
...
...
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