diff options
author | mdankov <mdankov@ffa7fe5e-494d-0410-b361-a75ebd5db220> | 2015-01-09 00:07:28 +0000 |
---|---|---|
committer | mdankov <mdankov@ffa7fe5e-494d-0410-b361-a75ebd5db220> | 2015-01-09 00:07:28 +0000 |
commit | da5c8824fb31d65ce807c0e86256041db5d99479 (patch) | |
tree | eccbf12f270d1aae6cb692ebba54f2f6feade66f /navit | |
parent | 8e0699d7d30eac074d2f5dc6fe03dd37f65667d0 (diff) | |
download | navit-svn-da5c8824fb31d65ce807c0e86256041db5d99479.tar.gz |
Fix:core:Report errors if graphics or event system is not present.
git-svn-id: http://svn.code.sf.net/p/navit/code/trunk/navit@5996 ffa7fe5e-494d-0410-b361-a75ebd5db220
Diffstat (limited to 'navit')
-rw-r--r-- | navit/event.c | 27 | ||||
-rw-r--r-- | navit/graphics.c | 5 |
2 files changed, 27 insertions, 5 deletions
diff --git a/navit/event.c b/navit/event.c index 550aa7fd..96d2e0dd 100644 --- a/navit/event.c +++ b/navit/event.c @@ -29,12 +29,24 @@ static const char *e_system; static int has_quit; +#define require_method_helper(m)\ + if(!event_methods.m) {\ + dbg(lvl_error, "Can't find event system method %s. Event system is %s%s\n",\ + #m ,e_system?"set to ":"not set.", e_system?e_system:"");\ + +#define require_method(m)\ + require_method_helper(m)\ + return;\ + } + +#define require_method2(m,r)\ + require_method_helper(m)\ + return r;\ + } + void event_main_loop_run(void) { - if (! event_methods.main_loop_run) { - dbg(lvl_error,"no event system set\n"); - return; - } + require_method(main_loop_run); event_methods.main_loop_run(); } @@ -54,42 +66,49 @@ event_main_loop_has_quit(void) struct event_watch * event_add_watch(int fd, enum event_watch_cond cond, struct callback *cb) { + require_method2(add_watch, NULL); return event_methods.add_watch(fd, cond, cb); } void event_remove_watch(struct event_watch *ev) { + require_method(remove_watch); event_methods.remove_watch(ev); } struct event_timeout * event_add_timeout(int timeout, int multi, struct callback *cb) { + require_method2(add_timeout, NULL); return event_methods.add_timeout(timeout, multi, cb); } void event_remove_timeout(struct event_timeout *ev) { + require_method(remove_timeout); event_methods.remove_timeout(ev); } struct event_idle * event_add_idle(int priority, struct callback *cb) { + require_method2(add_idle, NULL); return event_methods.add_idle(priority,cb); } void event_remove_idle(struct event_idle *ev) { + require_method(remove_idle); event_methods.remove_idle(ev); } void event_call_callback(struct callback_list *cb) { + require_method(call_callback); event_methods.call_callback(cb); } diff --git a/navit/graphics.c b/navit/graphics.c index 53a1984a..2858de82 100644 --- a/navit/graphics.c +++ b/navit/graphics.c @@ -232,12 +232,15 @@ struct graphics * graphics_new(struct attr *parent, struct attr **attrs) struct graphics_priv * (*graphicstype_new)(struct navit *nav, struct graphics_methods *meth, struct attr **attrs, struct callback_list *cbl); if (! (type_attr=attr_search(attrs, NULL, attr_type))) { + dbg(lvl_error,"Graphics plugin type is not set.\n"); return NULL; } graphicstype_new=plugin_get_graphics_type(type_attr->u.str); - if (! graphicstype_new) + if (! graphicstype_new) { + dbg(lvl_error,"Failed to load graphics plugin %s.\n", type_attr->u.str); return NULL; + } this_=g_new0(struct graphics, 1); this_->attrs=attr_list_dup(attrs); this_->cbl=callback_list_new(); |