System.Data.SQLite
Check-in [3303a4f55b]
Not logged in

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:In the SQLiteLog.DomainUnload method, make sure to undo all things done in the SQLiteLog.Initialize method. Possible fix for ticket [98c70ac5a7].
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 3303a4f55b1de68ece45a53aa27fe2203134e725
User & Date: mistachkin 2011-10-18 03:07:04
References
2011-10-20
07:23 Closed ticket [98c70ac5a7]: SQLiteFactory raises CallbackOnCollectedDelegate plus 2 other changes artifact: 02878a4f6c user: mistachkin
2011-10-18
03:08 Pending ticket [98c70ac5a7]. artifact: 21d58b59eb user: mistachkin
Context
2011-10-18
03:23
Add an example MDA configuration file for Eagle suitable for use with the test suite. check-in: 7bade0d7b1 user: mistachkin tags: trunk
03:07
In the SQLiteLog.DomainUnload method, make sure to undo all things done in the SQLiteLog.Initialize method. Possible fix for ticket [98c70ac5a7]. check-in: 3303a4f55b user: mistachkin tags: trunk
2011-10-15
12:38
Improve test thread cleanup in test for ticket [84718e79fa]. check-in: 9e77b34813 user: mistachkin tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to System.Data.SQLite/SQLiteLog.cs.

   188    188           private static void DomainUnload(
   189    189               object sender,
   190    190               EventArgs e
   191    191               )
   192    192           {
   193    193               lock (syncRoot)
   194    194               {
          195  +                //
          196  +                // NOTE: Remove the default log event handler.
          197  +                //
          198  +                RemoveDefaultHandler();
          199  +
          200  +                //
          201  +                // NOTE: Disable logging.  If necessary, it can be re-enabled
          202  +                //       later by the Initialize method.
          203  +                //
          204  +                _enabled = false;
          205  +
   195    206                   //
   196    207                   // BUGBUG: This will cause serious problems if other AppDomains
   197    208                   //         have any open SQLite connections; however, there is
   198    209                   //         currently no way around this limitation.
   199    210                   //
   200    211                   if (_sql != null)
   201    212                   {
................................................................................
   207    218   
   208    219                       rc = _sql.SetLogCallback(null);
   209    220   
   210    221                       if (rc != 0)
   211    222                           throw new SQLiteException(rc,
   212    223                               "Failed to shutdown logging.");
   213    224                   }
          225  +
          226  +                //
          227  +                // BUGFIX: Make sure to reset the callback for next time.  This
          228  +                //         must be done after it has been succesfully removed
          229  +                //         as logging callback by the SQLite core library as we
          230  +                //         cannot allow native code to refer to a delegate that
          231  +                //         has been garbage collected.
          232  +                //
          233  +                if (_callback != null)
          234  +                {
          235  +                    _callback = null;
          236  +                }
   214    237   
   215    238                   //
   216    239                   // NOTE: Remove the event handler for the DomainUnload event
   217    240                   //       that we added earlier.
   218    241                   //
   219    242                   if (_domainUnload != null)
   220    243                   {