summaryrefslogtreecommitdiff
path: root/navit/osd
diff options
context:
space:
mode:
authormdankov <mdankov@ffa7fe5e-494d-0410-b361-a75ebd5db220>2012-12-05 20:48:06 +0000
committermdankov <mdankov@ffa7fe5e-494d-0410-b361-a75ebd5db220>2012-12-05 20:48:06 +0000
commit420b235a2d88265d1d1188714eabc4cc8d01f1aa (patch)
tree1522162da9872134a4b585a6eafbdf96592f8cbc /navit/osd
parentf3ded7bd4be86bee3b35a0913c725f08c7857b08 (diff)
downloadnavit-svn-420b235a2d88265d1d1188714eabc4cc8d01f1aa.tar.gz
Fix:osd_core:Don't crash when "src" attribute of osd types "button" and "image" is set to nonexistent file with command interface.
git-svn-id: http://svn.code.sf.net/p/navit/code/trunk/navit@5285 ffa7fe5e-494d-0410-b361-a75ebd5db220
Diffstat (limited to 'navit/osd')
-rw-r--r--navit/osd/core/osd_core.c30
1 files changed, 8 insertions, 22 deletions
diff --git a/navit/osd/core/osd_core.c b/navit/osd/core/osd_core.c
index a7c6d2b7..43628131 100644
--- a/navit/osd/core/osd_core.c
+++ b/navit/osd/core/osd_core.c
@@ -1434,7 +1434,8 @@ osd_button_draw(struct osd_priv_common *opc, struct navit *nav)
if (!opc->osd_item.configured)
return;
osd_wrap_point(&bp, nav);
- graphics_draw_image(opc->osd_item.gr, opc->osd_item.graphic_bg, &bp, this->img);
+ if(this->img)
+ graphics_draw_image(opc->osd_item.gr, opc->osd_item.graphic_bg, &bp, this->img);
}
static void
@@ -1571,23 +1572,6 @@ osd_button_new(struct navit *nav, struct osd_methods *meth,
return NULL;
}
-struct osd_image {
- int use_overlay;
- struct callback *draw_cb,*navit_init_cb;
- struct graphics_image *img;
- char *src;
-};
-
-static void
-osd_image_draw(struct osd_priv_common *opc, struct navit *nav)
-{
- struct osd_button *this = (struct osd_button *)opc->data;
-
- struct point bp = opc->osd_item.p;
- osd_wrap_point(&bp, nav);
- graphics_draw_image(opc->osd_item.gr, opc->osd_item.graphic_bg, &bp, this->img);
-}
-
static void
osd_image_init(struct osd_priv_common *opc, struct navit *nav)
{
@@ -1621,21 +1605,22 @@ osd_image_init(struct osd_priv_common *opc, struct navit *nav)
opc->osd_item.graphic_bg=graphics_gc_new(opc->osd_item.gr);
graphics_add_callback(gra, this->draw_cb=callback_new_attr_2(callback_cast(osd_button_draw), attr_postdraw, opc, nav));
}
- osd_image_draw(opc,nav);
+ osd_button_draw(opc,nav);
}
static struct osd_priv *
osd_image_new(struct navit *nav, struct osd_methods *meth,
struct attr **attrs)
{
- struct osd_image *this = g_new0(struct osd_image, 1);
+ struct osd_button *this = g_new0(struct osd_button, 1);
struct osd_priv_common *opc = g_new0(struct osd_priv_common,1);
struct attr *attr;
opc->data = (void*)this;
opc->osd_item.navit = nav;
- opc->osd_item.meth.draw = osd_draw_cast(osd_image_draw);
+ opc->osd_item.meth.draw = osd_draw_cast(osd_button_draw);
meth->set_attr = (void (*)(struct osd_priv *osd, struct attr* attr))set_std_osd_attr;
+ opc->spec_set_attr_func = osd_button_set_attr;
osd_set_std_attr(attrs, &opc->osd_item, 1);
@@ -1652,8 +1637,9 @@ osd_image_new(struct navit *nav, struct osd_methods *meth,
navit_add_callback(nav, this->navit_init_cb = callback_new_attr_1(callback_cast (osd_image_init), attr_graphics_ready, opc));
- return (struct osd_priv *) this;
+ return (struct osd_priv *) opc;
error:
+ g_free(opc);
g_free(this);
return NULL;
}