if (!this_->gra) {
struct color c;
this_->gra=graphics_overlay_new(gra, &this_->cursor_pnt, this_->w, this_->h, 65535);
- this_->bg=graphics_gc_new(this_->gra);
- c.r=0; c.g=0; c.b=0; c.a=0;
- graphics_gc_set_foreground(this_->bg, &c);
- graphics_background_gc(this_->gra, this_->bg);
+ if (this_->gra) {
+ this_->bg=graphics_gc_new(this_->gra);
+ c.r=0; c.g=0; c.b=0; c.a=0;
+ graphics_gc_set_foreground(this_->bg, &c);
+ graphics_background_gc(this_->gra, this_->bg);
+ }
}
cursor_draw_do(this_, lazy);
}
struct graphics * graphics_overlay_new(struct graphics *parent, struct point *p, int w, int h, int alpha)
{
struct graphics *this_;
+ if (!parent->meth.overlay_new)
+ return NULL;
this_=g_new0(struct graphics, 1);
this_->priv=parent->meth.overlay_new(parent->priv, &this_->meth, p, w, h, alpha);
+ if (!this_->priv) {
+ g_free(this_);
+ this_=NULL;
+ }
return this_;
}