Skip to content

Commit b73b451

Browse files
committed
An attempt was made to prevent occurrence of the access violation exception
1 parent 411f8d4 commit b73b451

File tree

4 files changed

+16
-5
lines changed

4 files changed

+16
-5
lines changed

NuGet/MsieJavaScriptEngine.nuspec

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@
1212
<requireLicenseAcceptance>false</requireLicenseAcceptance>
1313
<description>This library is a .NET wrapper for working with the JavaScript engines of Internet Explorer and Edge (JsRT versions of Chakra, ActiveScript version of Chakra and Classic JavaScript Engine). Project was based on the code of SassAndCoffee.JavaScript (http://github.com/paulcbetts/SassAndCoffee), Chakra Sample Hosts (http://github.com/panopticoncentral/chakra-host) and jsrt-dotnet (http://github.com/robpaveza/jsrt-dotnet).</description>
1414
<summary>This library is a .NET wrapper for working with the JavaScript engines of Internet Explorer and Edge (JsRT versions of Chakra, ActiveScript version of Chakra and Classic JavaScript Engine).</summary>
15-
<releaseNotes>Now during debugging in ActiveScript modes the script error contains a error location.</releaseNotes>
15+
<releaseNotes>1. In JsRT modes fixed a problems in calculation of error locations;
16+
2. An attempt was made to prevent occurrence of the access violation exception.</releaseNotes>
1617
<copyright>Copyright (c) 2012-2017 Andrey Taritsyn - http://www.taritsyn.ru</copyright>
1718
<language>en-US</language>
1819
<tags>JavaScript ECMAScript MSIE IE Edge Chakra</tags>

NuGet/readme.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@
2121
=============
2222
RELEASE NOTES
2323
=============
24-
Now during debugging in ActiveScript modes the script error contains a error
25-
location.
24+
1. In JsRT modes fixed a problems in calculation of error locations;
25+
2. An attempt was made to prevent occurrence of the access violation exception.
2626

2727
============
2828
PROJECT SITE

src/MsieJavaScriptEngine/JsRt/Edge/ChakraEdgeJsRtJsEngine.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ public ChakraEdgeJsRtJsEngine(bool enableDebugging)
6262
{
6363
_jsRuntime = CreateJsRuntime();
6464
_jsContext = _jsRuntime.CreateContext();
65+
_jsContext.AddRef();
6566
}
6667
catch (JsUsageException e)
6768
{
@@ -1117,7 +1118,11 @@ protected override void Dispose(bool disposing)
11171118
{
11181119
if (_dispatcher != null)
11191120
{
1120-
_dispatcher.Invoke(() => _jsRuntime.Dispose());
1121+
_dispatcher.Invoke(() =>
1122+
{
1123+
_jsContext.Release();
1124+
_jsRuntime.Dispose();
1125+
});
11211126
_dispatcher.Dispose();
11221127
}
11231128

src/MsieJavaScriptEngine/JsRt/Ie/ChakraIeJsRtJsEngine.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ public ChakraIeJsRtJsEngine(bool enableDebugging)
6868
{
6969
_jsRuntime = CreateJsRuntime();
7070
_jsContext = _jsRuntime.CreateContext();
71+
_jsContext.AddRef();
7172
}
7273
catch (JsUsageException e)
7374
{
@@ -1156,7 +1157,11 @@ protected override void Dispose(bool disposing)
11561157
{
11571158
if (_dispatcher != null)
11581159
{
1159-
_dispatcher.Invoke(() => _jsRuntime.Dispose());
1160+
_dispatcher.Invoke(() =>
1161+
{
1162+
_jsContext.Release();
1163+
_jsRuntime.Dispose();
1164+
});
11601165
_dispatcher.Dispose();
11611166
}
11621167

0 commit comments

Comments
 (0)