]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Fix a bug in a test file causing malloc5.test to crash. (CVS 4331)
authordanielk1977 <danielk1977@noemail.net>
Thu, 30 Aug 2007 08:27:39 +0000 (08:27 +0000)
committerdanielk1977 <danielk1977@noemail.net>
Thu, 30 Aug 2007 08:27:39 +0000 (08:27 +0000)
FossilOrigin-Name: ab09967bd2dd291030850d44c0862fbb7d0d8118

manifest
manifest.uuid
src/test3.c

index 5fec02b7c922cf32641708914ea62c2c7c704e7a..43db9805ad71ad48c02b8574b3d7801eb31b5057 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Add\stests\sfor\smalloc()\sfailure\swhen\sthe\satomic-write\soptimization\sis\sbeing\sused.\sAlso\sfix\sthings\sso\sthat\srollback\scan\soccur\swithout\sa\smalloc(),\seven\sif\sthere\sis\sa\smaster\sjournal\sfile.\s(CVS\s4330)
-D 2007-08-30T08:08:17
+C Fix\sa\sbug\sin\sa\stest\sfile\scausing\smalloc5.test\sto\scrash.\s(CVS\s4331)
+D 2007-08-30T08:27:40
 F Makefile.in bfcc303429a5d9dcd552d807ee016c77427418c3
 F Makefile.linux-gcc 65241babba6faf1152bf86574477baab19190499
 F README 9c4e2d6706bdcc3efdd773ce752a8cdab4f90028
@@ -138,7 +138,7 @@ F src/table.c 1aeb9eab57b4235db86fe15a35dec76fb445a9c4
 F src/tclsqlite.c d76af53f45c9e9f7f7d39531fa4c7bee7d0adad6
 F src/test1.c 8b20d1f05777ac480d3caf8d5f79ab7a543513fc
 F src/test2.c 4ab230fbdc0decfa7422f6a052b609ba54f4dfac
-F src/test3.c 09098991c3a94a1c7f54d28888fca2951d459585
+F src/test3.c 199a440ba2b38b26251393b609451a3484a15907
 F src/test4.c c2c0f5dc907f1346f5d4b65eb5799f11eb9e4071
 F src/test5.c 3a6a5717a149d7ca2e6d14f5be72cf7555d54dc4
 F src/test6.c a6223d9d938aba83f20611a2c01680d8043cd2f7
@@ -568,7 +568,7 @@ F www/tclsqlite.tcl 8be95ee6dba05eabcd27a9d91331c803f2ce2130
 F www/vdbe.tcl 87a31ace769f20d3627a64fa1fade7fed47b90d0
 F www/version3.tcl 890248cf7b70e60c383b0e84d77d5132b3ead42b
 F www/whentouse.tcl fc46eae081251c3c181bd79c5faef8195d7991a5
-P cddce4950569ac49c1a5224b200b00dcd83a2ba4
-R e861f1719df1b7e8bf2776501010b8d3
+P 481fd3a89e50e329596d96565170e3d9977aae29
+R d13eabcd88c2079e0e183a72f4935be0
 U danielk1977
-Z d772ae35eed9ac8826bc4538e7174609
+Z 1ec28bb5a6454a9a162a1baa77f48c30
index 139d5e918a39e0e4ca50873eedda33bf9eac02df..ef0bb7c4ee2590706544bd8793e019fe9994e990 100644 (file)
@@ -1 +1 @@
-481fd3a89e50e329596d96565170e3d9977aae29
\ No newline at end of file
+ab09967bd2dd291030850d44c0862fbb7d0d8118
\ No newline at end of file
index f132db9e8e36db7d3fc9da212d761333df44a252..d2a6071e47e7d0d0184919c28dee348e0abd10f0 100644 (file)
@@ -13,7 +13,7 @@
 ** is not included in the SQLite library.  It is used for automated
 ** testing of the SQLite library.
 **
-** $Id: test3.c,v 1.84 2007/08/29 17:43:20 drh Exp $
+** $Id: test3.c,v 1.85 2007/08/30 08:27:40 danielk1977 Exp $
 */
 #include "sqliteInt.h"
 #include "btreeInt.h"
@@ -557,6 +557,16 @@ static int btree_pager_stats(
     return TCL_ERROR;
   }
   pBt = sqlite3TextToPtr(argv[1]);
+  /* Normally in this file, with a b-tree handle opened using the 
+  ** [btree_open] command it is safe to call sqlite3BtreeEnter() directly.
+  ** But this function is sometimes called with a btree handle obtained
+  ** from an open SQLite connection (using [btree_from_db]). In this case
+  ** we need to obtain the mutex for the controlling SQLite handle before
+  ** it is safe to call sqlite3BtreeEnter().
+  */
+  sqlite3_mutex_enter(pBt->pSqlite->mutex);
+
   sqlite3BtreeEnter(pBt);
   a = sqlite3PagerStats(sqlite3BtreePager(pBt));
   for(i=0; i<11; i++){
@@ -570,6 +580,9 @@ static int btree_pager_stats(
     Tcl_AppendElement(interp, zBuf);
   }
   sqlite3BtreeLeave(pBt);
+
+  /* Release the mutex on the SQLite handle that controls this b-tree */
+  sqlite3_mutex_leave(pBt->pSqlite->mutex);
   return TCL_OK;
 }