X-Git-Url: https://git.cweiske.de/enigma2.git/blobdiff_plain/b887d75af86b430552cc28ea5e37bf58bd557d4b..225c99450eab2aba7aa0e8ea3d2ff73da2910d46:/lib/gdi/grc.cpp diff --git a/lib/gdi/grc.cpp b/lib/gdi/grc.cpp index a9bac4af..736630a8 100644 --- a/lib/gdi/grc.cpp +++ b/lib/gdi/grc.cpp @@ -63,6 +63,7 @@ void gRC::submit(const gOpcode &o) if ( tmp == rp ) { #ifndef SYNC_PAINT + pthread_cond_signal(&cond); // wakeup gdi thread pthread_mutex_unlock(&mutex); #else thread(); @@ -115,7 +116,11 @@ void *gRC::thread() else if (o.opcode==gOpcode::notify) need_notify = 1; else + { o.dc->exec(&o); + // o.dc is a gDC* filled with grabref... so we must release it here + o.dc->Release(); + } } else { @@ -125,7 +130,8 @@ void *gRC::thread() m_notify_pump.send(1); } #ifndef SYNC_PAINT - pthread_cond_wait(&cond, &mutex); + while(rp == wp) + pthread_cond_wait(&cond, &mutex); pthread_mutex_unlock(&mutex); #endif } @@ -236,7 +242,7 @@ void gPainter::renderText(const eRect &pos, const std::string &string, int flags o.dc = m_dc.grabRef(); o.parm.renderText = new gOpcode::para::prenderText; o.parm.renderText->area = pos; - o.parm.renderText->text = string; + o.parm.renderText->text = string.empty()?0:strdup(string.c_str()); o.parm.renderText->flags = flags; m_rc->submit(o); } @@ -538,7 +544,8 @@ void gDC::exec(gOpcode *o) assert(m_current_font); para->setFont(m_current_font); para->renderString(o->parm.renderText->text, (flags & gPainter::RT_WRAP) ? RS_WRAP : 0); - + if (o->parm.renderText->text) + free(o->parm.renderText->text); if (flags & gPainter::RT_HALIGN_RIGHT) para->realign(eTextPara::dirRight); else if (flags & gPainter::RT_HALIGN_CENTER)