[fixed] Change theme can cause client crash (1 Viewer)

Smeulf

Retired Team Member
  • Premium Supporter
  • October 27, 2010
    672
    454
    France
    Home Country
    France France
    Maybe a hard to solve bug, and a hard one to report correctly : randomly the client crash while changing theme. I have multiples errors at differents points of the code, I assume it can be a threading problem. Step to reproduce : Change style, change style and change style, pretty fast if possible.

    Error 1 : SkinResources.cs, lines 392-399; At foreach instruction, collection has been modified, can't enumerate

    Code:
        protected virtual void CheckResourcesInitialized()
        {
          if (IsResourcesInitialized)
            return;
          _localResourceFilePaths = new Dictionary<string, string>();
          [B]foreach[/B] (string rootDirectoryPath in _rootDirectoryPaths)
            LoadDirectory(rootDirectoryPath);
        }

    Error 2 : FontAssetCore.cs, lines 234-239; AtFT.FT_Set_Char_Size, attempt to read or write protected memory

    Code:
        private bool AddGlyph(uint glyphIndex)
        {
          // FreeType measures font size in terms Of 1/64ths of a point.
          // 1 point = 1/72th of an inch. Resolution is in dots (pixels) per inch.
          float point_size = 64.0f * _charSet.RenderedSize * 72.0f / _resolution;
          [B]FT.FT_Set_Char_Size(_family.Face, (int) point_size, 0, _resolution, 0);[/B]
    Error 3 : SkinResources line 524 in "protected virtual void LoadDirectory(string rootDirectoryPath)" method : NullReferenceExeption because of _localResourceFilePaths.Count = 0

    Code:
            if (_localResourceFilePaths.ContainsKey(resourceName))

    There are others errors, but I think there is only one origin so I'll stop enumerate them for now. Ask if you need more error samples.

    Cheers.

    Smeulf.
     

    Albert

    MP2 Developer
  • Premium Supporter
  • February 18, 2008
    1,297
    1,130
    45
    Freiburg im Breisgau, Germany
    Home Country
    Germany Germany
    AW: Change theme can cause client crash

    Those errors you pointed out above are certainly problems which are caused by multiple threads trying to reload the skin resources. The only question is: How did you achieve it to make multiple threads come into that code? Maybe you got a button in the skin pressed while the skin is being reloaded. I think I'll lock the input manager thread while reloading the skin resources.
     

    Smeulf

    Retired Team Member
  • Premium Supporter
  • October 27, 2010
    672
    454
    France
    Home Country
    France France
    Re: AW: Change theme can cause client crash

    Those errors you pointed out above are certainly problems which are caused by multiple threads trying to reload the skin resources. The only question is: How did you achieve it to make multiple threads come into that code? Maybe you got a button in the skin pressed while the skin is being reloaded. I think I'll lock the input manager thread while reloading the skin resources.

    Additional info, sorry I didn't note that before : just before it crash

    Code:
    [2011-09-02 15:51:55,720] [40698  ] [InputMgr ] [DEBUG] - ScreenManager: Trying to load skin '' with theme 'silver'
    [2011-09-02 15:51:55,720] [40698  ] [DX Render] [INFO ] - SkinResources: Adding skin resource directory 'D:\Smeulf\Desktop\MP2\MediaPortal\Bin\MP2-Client\bin\x86\Debug\Plugins\SkinBase\Skin\default\themes\default' to Theme 'default'
    [2011-09-02 15:51:55,730] [40708  ] [DX Render] [INFO ] - SkinResources: Adding skin resource directory 'D:\Smeulf\Desktop\MP2\MediaPortal\Bin\MP2-Client\bin\x86\Debug\Plugins\Media\Skin\default\themes\default' to Theme 'default'
    [2011-09-02 15:51:55,740] [40718  ] [DX Render] [INFO ] - SkinResources: Adding skin resource directory 'D:\Smeulf\Desktop\MP2\MediaPortal\Bin\MP2-Client\bin\x86\Debug\Plugins\SlimTvClient\Skin\default\themes\default' to Theme 'default'
    [2011-09-02 15:51:55,740] [40718  ] [InputMgr ] [INFO ] - SkinResources: Adding skin resource directory 'D:\Smeulf\Desktop\MP2\MediaPortal\Bin\MP2-Client\bin\x86\Debug\Plugins\Configuration\Skin\default' to Skin 'default'
    [2011-09-02 15:51:55,740] [40718  ] [InputMgr ] [INFO ] - SkinResources: Adding skin resource directory 'D:\Smeulf\Desktop\MP2\MediaPortal\Bin\MP2-Client\bin\x86\Debug\Plugins\SkinBase\Skin\default' to Skin 'default'

    You can see both DX Render and InputMgr trying to load the skin. Here is the multithreading problem.

    This test is done after you locked input manager while changing the theme.

    Cheers.
     

    Smeulf

    Retired Team Member
  • Premium Supporter
  • October 27, 2010
    672
    454
    France
    Home Country
    France France
    Fixed after some debug with Albert.

    Thanks to him.

    Smeulf.
     

    Users who are viewing this thread

    Top Bottom