Merge pull request #1071 from mapbox/1071-sqlite-avoid-crash

Gracefully handle SQLite errors
This commit is contained in:
Konstantin Käfer
2015-04-08 16:48:58 +02:00
11 changed files with 581 additions and 105 deletions

View File

@@ -4,6 +4,7 @@
#include <mbgl/platform/event.hpp>
#include <mbgl/util/std.hpp>
#include <mbgl/util/noncopyable.hpp>
#include <memory>
#include <string>
@@ -12,7 +13,7 @@ namespace mbgl {
class Log {
public:
class Observer {
class Observer : private util::noncopyable {
public:
virtual ~Observer() = default;
@@ -22,6 +23,7 @@ public:
};
static void setObserver(std::unique_ptr<Observer> Observer);
static std::unique_ptr<Observer> removeObserver();
private:
template <typename T, size_t N>

View File

@@ -38,6 +38,7 @@ private:
void process(StopAction &action);
void createDatabase();
void createSchema();
const std::string path;
uv_loop_t *loop = nullptr;
@@ -45,6 +46,7 @@ private:
std::thread thread;
std::unique_ptr<::mapbox::sqlite::Database> db;
std::unique_ptr<::mapbox::sqlite::Statement> getStmt, putStmt, refreshStmt;
bool schema = false;
};
}