diff options
author | phintuka <phintuka> | 2008-09-21 13:51:07 +0000 |
---|---|---|
committer | phintuka <phintuka> | 2008-09-21 13:51:07 +0000 |
commit | 8c942cc9db7f7ad14cd13f73fbb67afc97afd957 (patch) | |
tree | 1a30bd9fdd551f3355c2267dbac0acfe3a280cb8 | |
parent | 7b1939c7e18e5cdcf4c14d15dbc1735867b88500 (diff) | |
download | xineliboutput-8c942cc9db7f7ad14cd13f73fbb67afc97afd957.tar.gz xineliboutput-8c942cc9db7f7ad14cd13f73fbb67afc97afd957.tar.bz2 |
Check if palette exists.
This should fix segfaults when committing uninitialized OSD.
(Thanks to Rolf Ahrenberg)
-rw-r--r-- | osd.c | 22 |
1 files changed, 12 insertions, 10 deletions
@@ -4,7 +4,7 @@ * See the main source file 'xineliboutput.c' for copyright information and * how to reach the author. * - * $Id: osd.c,v 1.24 2008-04-29 12:44:25 phintuka Exp $ + * $Id: osd.c,v 1.25 2008-09-21 13:51:07 phintuka Exp $ * */ @@ -211,7 +211,7 @@ void cXinelibOsd::CmdRle(int Wnd, int X0, int Y0, if(m_Device) { osd_command_t osdcmd; - xine_clut_t clut[256]; + xine_clut_t clut[Colors]; memset(&osdcmd, 0, sizeof(osdcmd)); osdcmd.cmd = OSD_Set_RLE; @@ -333,14 +333,16 @@ void cXinelibOsd::Flush(void) /* XXX what if only palette has been changed ? */ int NumColors; const tColor *Colors = Bitmap->Colors(NumColors); - osd_rect_t DirtyArea = {x1:x1, y1:y1, x2:x2, y2:y2}; - CmdRle(i, - Left() + Bitmap->X0(), Top() + Bitmap->Y0(), - Bitmap->Width(), Bitmap->Height(), - (unsigned char *)Bitmap->Data(0,0), - NumColors, (unsigned int *)Colors, - &DirtyArea); - SendDone++; + if (Colors) { + osd_rect_t DirtyArea = {x1:x1, y1:y1, x2:x2, y2:y2}; + CmdRle(i, + Left() + Bitmap->X0(), Top() + Bitmap->Y0(), + Bitmap->Width(), Bitmap->Height(), + (unsigned char *)Bitmap->Data(0,0), + NumColors, (unsigned int *)Colors, + &DirtyArea); + SendDone++; + } } Bitmap->Clean(); } |