Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
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-winehq
Commits
b1c7f544
Commit
b1c7f544
authored
Oct 14, 2011
by
Jacek Caban
Committed by
Alexandre Julliard
Oct 14, 2011
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
vbscript: Keep script context alive after Close call, but make it reusable.
parent
b7a15ae7
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
45 additions
and
17 deletions
+45
-17
vbscript.c
dlls/vbscript/vbscript.c
+45
-17
No files found.
dlls/vbscript/vbscript.c
View file @
b1c7f544
...
...
@@ -110,13 +110,10 @@ static HRESULT set_ctx_site(VBScript *This)
return
S_OK
;
}
static
void
destroy
_script
(
script_ctx_t
*
ctx
)
static
void
release
_script
(
script_ctx_t
*
ctx
)
{
collect_objects
(
ctx
);
while
(
!
list_empty
(
&
ctx
->
code_list
))
release_vbscode
(
LIST_ENTRY
(
list_head
(
&
ctx
->
code_list
),
vbscode_t
,
entry
));
while
(
!
list_empty
(
&
ctx
->
named_items
))
{
named_item_t
*
iter
=
LIST_ENTRY
(
list_head
(
&
ctx
->
named_items
),
named_item_t
,
entry
);
...
...
@@ -127,19 +124,46 @@ static void destroy_script(script_ctx_t *ctx)
heap_free
(
iter
);
}
if
(
ctx
->
host_global
)
if
(
ctx
->
host_global
)
{
IDispatch_Release
(
ctx
->
host_global
);
if
(
ctx
->
secmgr
)
ctx
->
host_global
=
NULL
;
}
if
(
ctx
->
secmgr
)
{
IInternetHostSecurityManager_Release
(
ctx
->
secmgr
);
if
(
ctx
->
site
)
ctx
->
secmgr
=
NULL
;
}
if
(
ctx
->
site
)
{
IActiveScriptSite_Release
(
ctx
->
site
);
if
(
ctx
->
err_obj
)
ctx
->
site
=
NULL
;
}
if
(
ctx
->
err_obj
)
{
IDispatchEx_Release
(
&
ctx
->
err_obj
->
IDispatchEx_iface
);
if
(
ctx
->
global_obj
)
ctx
->
err_obj
=
NULL
;
}
if
(
ctx
->
global_obj
)
{
IDispatchEx_Release
(
&
ctx
->
global_obj
->
IDispatchEx_iface
);
if
(
ctx
->
script_obj
)
ctx
->
global_obj
=
NULL
;
}
if
(
ctx
->
script_obj
)
{
IDispatchEx_Release
(
&
ctx
->
script_obj
->
IDispatchEx_iface
);
ctx
->
script_obj
=
NULL
;
}
vbsheap_free
(
&
ctx
->
heap
);
vbsheap_init
(
&
ctx
->
heap
);
}
static
void
destroy_script
(
script_ctx_t
*
ctx
)
{
while
(
!
list_empty
(
&
ctx
->
code_list
))
release_vbscode
(
LIST_ENTRY
(
list_head
(
&
ctx
->
code_list
),
vbscode_t
,
entry
));
release_script
(
ctx
);
heap_free
(
ctx
);
}
...
...
@@ -167,13 +191,12 @@ static void decrease_state(VBScript *This, SCRIPTSTATE state)
This
->
site
=
NULL
;
}
This
->
thread_id
=
0
;
if
(
state
==
SCRIPTSTATE_CLOSED
)
{
destroy_script
(
This
->
ctx
);
This
->
ctx
=
NULL
;
}
if
(
This
->
ctx
)
release_script
(
This
->
ctx
);
This
->
thread_id
=
0
;
break
;
case
SCRIPTSTATE_CLOSED
:
break
;
default:
assert
(
0
);
...
...
@@ -229,6 +252,11 @@ static ULONG WINAPI VBScript_Release(IActiveScript *iface)
TRACE
(
"(%p) ref=%d
\n
"
,
iface
,
ref
);
if
(
!
ref
)
{
if
(
This
->
ctx
)
{
decrease_state
(
This
,
SCRIPTSTATE_CLOSED
);
destroy_script
(
This
->
ctx
);
This
->
ctx
=
NULL
;
}
if
(
This
->
site
)
IActiveScriptSite_Release
(
This
->
site
);
heap_free
(
This
);
...
...
@@ -413,7 +441,7 @@ static HRESULT WINAPI VBScript_GetScriptDispatch(IActiveScript *iface, LPCOLESTR
if
(
!
ppdisp
)
return
E_POINTER
;
if
(
This
->
thread_id
!=
GetCurrentThreadId
()
||
!
This
->
ctx
->
script_obj
)
{
if
(
This
->
thread_id
!=
GetCurrentThreadId
()
||
!
This
->
ctx
||
!
This
->
ctx
->
script_obj
)
{
*
ppdisp
=
NULL
;
return
E_UNEXPECTED
;
}
...
...
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