1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-07-29 08:01:23 +03:00

Remove two incorrect calls to structType.dipose() which prematurely freed objects in use by the virtual table test/demo code.

FossilOrigin-Name: 060eb2848975a24ff6683a8a9c4d7546ae36147323b0edae01fb42f52d9bb2d6
This commit is contained in:
stephan
2022-12-10 15:41:47 +00:00
parent 9cb6ff2792
commit 8c0041f5bf
4 changed files with 70 additions and 69 deletions

View File

@ -319,16 +319,6 @@ self.sqlite3ApiBootstrap.initializers.push(function(sqlite3){
return this;
};
/**
Expects to be passed the (argc,argv) arguments of
sqlite3_module::xFilter(), or an equivalent API. This function
transforms the arguments (an array of (sqlite3_value*)) into a JS
array of equivalent JS values. It uses the same type conversions
as sqlite3_create_function_v2() and friends. Throws on error,
e.g. if it cannot figure out a sensible data conversion.
*/
vtab.sqlite3ValuesToJs = capi.sqlite3_create_function_v2.udfConvertArgs;
/**
Internal factory function for xVtab and xCursor impls.
*/
@ -401,6 +391,9 @@ self.sqlite3ApiBootstrap.initializers.push(function(sqlite3){
sqlite3_vtab_cursor: to be called from any sqlite3_module methods
which take a `sqlite3_vtab_cursor*` argument except xClose(),
in which case use unget() or dispose().
Rule to remember: _never_ call dispose() on an instance
returned by this function.
*/
get: (pCObj)=>__xWrap(pCObj),
/**
@ -416,6 +409,9 @@ self.sqlite3ApiBootstrap.initializers.push(function(sqlite3){
sqlite3_vtab_cursor: to be called from xClose() or during
cleanup in a failed xOpen().
Calling this method obligates the caller to call dispose() on
the returned object when they're done with it.
*/
unget: (pCObj)=>__xWrap(pCObj,true),
/**

View File

@ -1388,7 +1388,10 @@ self.sqlite3InitModule = sqlite3InitModule;
}/*sqlite3_js_vfs_create_file()*/)
////////////////////////////////////////////////////////////////////
.t('Scalar UDFs', function(sqlite3){
.t({
name:'Scalar UDFs',
//predicate: ()=>false,
test: function(sqlite3){
const db = this.db;
db.createFunction("foo",(pCx,a,b)=>a+b);
T.assert(7===db.selectValue("select foo(3,4)")).
@ -1437,11 +1440,13 @@ self.sqlite3InitModule = sqlite3InitModule;
assert(2 === blobRc.length);
//debug("blobRc=",blobRc);
T.assert(0x68==blobRc[0] && 0x69==blobRc[1]);
}
})
////////////////////////////////////////////////////////////////////
.t({
name: 'Aggregate UDFs',
//predicate: ()=>false,
test: function(sqlite3){
const db = this.db;
const sjac = capi.sqlite3_js_aggregate_context;
@ -1512,6 +1517,7 @@ self.sqlite3InitModule = sqlite3InitModule;
.t({
name: 'Aggregate UDFs (64-bit)',
predicate: ()=>wasm.bigIntEnabled,
//predicate: ()=>false,
test: function(sqlite3){
const db = this.db;
const sjac = capi.sqlite3_js_aggregate_context;
@ -1538,6 +1544,7 @@ self.sqlite3InitModule = sqlite3InitModule;
////////////////////////////////////////////////////////////////////
.t({
name: 'Window UDFs',
//predicate: ()=>false,
test: function(){
/* Example window function, table, and results taken from:
https://sqlite.org/windowfunctions.html#udfwinfunc */
@ -1856,7 +1863,6 @@ self.sqlite3InitModule = sqlite3InitModule;
xEof: function(pCursor){
const c = VT.xCursor.get(pCursor),
rc = c._rowId>=10;
c.dispose();
return rc;
},
xFilter: function(pCursor, idxNum, idxCStr,
@ -1864,10 +1870,9 @@ self.sqlite3InitModule = sqlite3InitModule;
try{
const c = VT.xCursor.get(pCursor);
c._rowId = 0;
const list = VT.sqlite3ValuesToJs(argc, argv);
const list = capi.sqlite3_values_to_js(argc, argv);
T.assert(argc === list.length);
//log(argc,"xFilter value(s):",list);
c.dispose();
return 0;
}catch(e){
return VT.xError('xFilter',e);
@ -2044,7 +2049,7 @@ self.sqlite3InitModule = sqlite3InitModule;
vtabTrace("xFilter",...arguments);
const c = VT.xCursor.get(pCursor);
c._rowId = 0;
const list = VT.sqlite3ValuesToJs(argc, argv);
const list = capi.sqlite3_values_to_js(argc, argv);
T.assert(argc === list.length);
},
xBestIndex: function(pVtab, pIdxInfo){

View File

@ -1,5 +1,5 @@
C Expose\ssqlite3_column_value()\sto\sWASM\sand\sadd\ssqlite3_column_js().
D 2022-12-10T15:13:29.279
C Remove\stwo\sincorrect\scalls\sto\sstructType.dipose()\swhich\sprematurely\sfreed\sobjects\sin\suse\sby\sthe\svirtual\stable\stest/demo\scode.
D 2022-12-10T15:41:47.936
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
@ -509,7 +509,7 @@ F ext/wasm/api/sqlite3-api-prologue.js 70ba9bfefacbf11727da6a8f404fccbe666353d09
F ext/wasm/api/sqlite3-api-worker1.js e94ba98e44afccfa482874cd9acb325883ade50ed1f9f9526beb9de1711f182f
F ext/wasm/api/sqlite3-license-version-header.js a661182fc93fc2cf212dfd0b987f8e138a3ac98f850b1112e29b5fbdaecc87c3
F ext/wasm/api/sqlite3-opfs-async-proxy.js 7795b84b66a7a8dedc791340709b310bb497c3c72a80bef364fa2a58e2ddae3f
F ext/wasm/api/sqlite3-v-helper.js 64bb3559446eb441ce87afe942f6f924ee135a9f069a82705ffefdcd55fc6481
F ext/wasm/api/sqlite3-v-helper.js 6f6c3e390a72e08b0a5b16a0d567d7af3c04d172831853a29d72a6f1dd40ff24
F ext/wasm/api/sqlite3-vfs-opfs.c-pp.js 66daf6fb6843bea615fe193109e1542efbeca24f560ee9da63375a910bb48115
F ext/wasm/api/sqlite3-wasi.h 25356084cfe0d40458a902afb465df8c21fc4152c1d0a59b563a3fba59a068f9
F ext/wasm/api/sqlite3-wasm.c daad00c6822facb6ceb506dadc2201c734e9128c457c93f9304df01542084216
@ -555,7 +555,7 @@ F ext/wasm/test-opfs-vfs.html 1f2d672f3f3fce810dfd48a8d56914aba22e45c6834e262555
F ext/wasm/test-opfs-vfs.js 44363db07b2a20e73b0eb1808de4400ca71b703af718d0fa6d962f15e73bf2ac
F ext/wasm/tester1-worker.html d43f3c131d88f10d00aff3e328fed13c858d674ea2ff1ff90225506137f85aa9
F ext/wasm/tester1.c-pp.html d34bef3d48e5cbc1c7c06882ad240fec49bf88f5f65696cc2c72c416933aa406
F ext/wasm/tester1.c-pp.js 88981420cd91fa134293fc15507b4c94923dab6b3d2e9fc9a4510fdb4f4c6368
F ext/wasm/tester1.c-pp.js 3e9f1d92d9f3464954553d0aa918cba8294451e32a38c229ce5964818f707702
F ext/wasm/tests/opfs/concurrency/index.html 86d8ac435074d1e7007b91105f4897f368c165e8cecb6a9aa3d81f5cf5dcbe70
F ext/wasm/tests/opfs/concurrency/test.js a98016113eaf71e81ddbf71655aa29b0fed9a8b79a3cdd3620d1658eb1cc9a5d
F ext/wasm/tests/opfs/concurrency/worker.js 0a8c1a3e6ebb38aabbee24f122693f1fb29d599948915c76906681bb7da1d3d2
@ -2067,8 +2067,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93
F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
P 35d1d63c7d60119b64341c561294890812837d5432d1d7bed3ed88d6212fbfa0
R 74949983660f34694e10167d70549cc3
P 7783aa4af1331190fd1f42a71bb724041e2e82b51745f9740926e4ead83a97ed
R 665d2c5db7dd22191a3e1edf86f2deb6
U stephan
Z 02a2b2f3f049d4f2376808efde37d6cf
Z 3ceb2605e22c9be9046cc21f4a5a89d8
# Remove this line to create a well-formed Fossil manifest.

View File

@ -1 +1 @@
7783aa4af1331190fd1f42a71bb724041e2e82b51745f9740926e4ead83a97ed
060eb2848975a24ff6683a8a9c4d7546ae36147323b0edae01fb42f52d9bb2d6