Browse files

egl: fix creation of XBMC icon texture.

CTexture iconTexture; will create a 0x0 texture and CTexture::LoadFromFile()
won't update that texture. Rather, it creates and returns a new object.
That's this object we want to use for SDL_WM_SetIcon() as initialization
data. i.e. that newly created object will have the right size.

Signed-off-by: Gwenole Beauchesne <>
  • Loading branch information...
1 parent abdf416 commit 196b26a29799234928ca3878db488e82b36c0a7e @gbeauchesne committed Aug 13, 2012
Showing with 9 additions and 3 deletions.
  1. +9 −3 xbmc/windowing/X11/WinSystemX11GLES.cpp
@@ -155,12 +155,18 @@ bool CWinSystemX11GLES::CreateNewWindow(const CStdString& name, bool fullScreen,
if(!SetFullScreen(fullScreen, res, false))
return false;
- CTexture iconTexture;
- iconTexture.LoadFromFile("special://xbmc/media/icon.png");
+ CBaseTexture *pIconTexture;
+ pIconTexture = CBaseTexture::LoadFromFile("special://xbmc/media/icon.png");
+ if (!pIconTexture)
+ {
+ CLog::Log(LOGERROR, "Failed to load XBMC icon");
+ return false;
+ }
- SDL_WM_SetIcon(SDL_CreateRGBSurfaceFrom(iconTexture.GetPixels(), iconTexture.GetWidth(), iconTexture.GetHeight(), BPP, iconTexture.GetPitch(), 0xff0000, 0x00ff00, 0x0000ff, 0xff000000L), NULL);
+ SDL_WM_SetIcon(SDL_CreateRGBSurfaceFrom(pIconTexture->GetPixels(), pIconTexture->GetWidth(), pIconTexture->GetHeight(), BPP, pIconTexture->GetPitch(), 0xff0000, 0x00ff00, 0x0000ff, 0xff000000L), NULL);
SDL_WM_SetCaption("XBMC Media Center", NULL);
+ delete pIconTexture;
m_bWindowCreated = true;
m_eglext = " ";

2 comments on commit 196b26a

We shouldn't fail to create the window just because the icon didn't load.


gbeauchesne replied Aug 19, 2012

OK, thanks, I will propagate the fix from WinSystemX11.cpp then. I just realized there was one there. Though, iconTexture probably needs to be checked for prior to delete'ing it. :)

Please sign in to comment.