Add coffeecatch to Map::run()

This commit is contained in:
Leith Bade
2014-11-16 20:04:36 +11:00
parent b216b04a59
commit 2aed807d4c
2 changed files with 17 additions and 1 deletions

View File

@@ -35,7 +35,8 @@ enum class Event : uint8_t {
Image,
OpenGL,
JNI,
Android
Android,
Crash
};
MBGL_DEFINE_ENUM_CLASS(EventClass, Event, {
@@ -52,6 +53,7 @@ MBGL_DEFINE_ENUM_CLASS(EventClass, Event, {
{ Event::OpenGL, "OpenGL" },
{ Event::JNI, "JNI" },
{ Event::Android, "Android" },
{ Event::Android, "Crash" },
{ Event(-1), "Unknown" },
});

View File

@@ -31,6 +31,10 @@
#include <uv.h>
#ifdef __ANDROID__
#include <coffeecatch/coffeecatch.h>
#endif
// Check libuv library version.
const static bool uv_version_check = []() {
const unsigned int version = uv_version();
@@ -251,6 +255,10 @@ void Map::resume() {
}
void Map::run() {
#ifdef __ANDROID__
COFFEE_TRY() {
#endif
#ifndef NDEBUG
if (!async) {
map_thread = main_thread;
@@ -280,6 +288,12 @@ void Map::run() {
map_thread = -1;
#endif
}
#ifdef __ANDROID__
} COFFEE_CATCH() {
Log::Error(Event::Crash, "Map::run() crash:\n%s", coffeecatch_get_message());
abort();
}
#endif
}
void Map::check_for_pause() {