cpp_client_telemetry icon indicating copy to clipboard operation
cpp_client_telemetry copied to clipboard

OfflineStorage_SQLite does not set m_isOpened on successful calls to recreate()

Open larvacea opened this issue 5 years ago • 0 comments

The Initialize() method in OfflineStorage_SQLite goes through these steps to set up and connect to the SQLite database:

  • Attempt to open and connect. On success:
  • m_isOpened = true
  • onStorageOpened("SQLite/Default")
  • return to caller
  • Attempt to delete and create new instance. On success:
  • onStorageOpened("SQLite/Clean")
  • return to caller
  • give up:
  • m_isOpened = false
  • onStorageOpened("SQLite/None")
  • return to caller

The failure to set m_isOpened in the SQLite/Clean case has (at least) one observable consequence. The OfflineStorage_SQLite destructor will fire an alert and crash debug builds because the SQLite * pointer is not nullptr. The pointer (and database) are live because Shutdown() tests m_isOpened and will not shut down and dispose the SQLite * instance if m_isOpened is false.

larvacea avatar Aug 26 '20 00:08 larvacea