A generic error occurred in GDI+ (1 Viewer)

and-81

Retired Team Member
  • Premium Supporter
  • March 7, 2005
    2,257
    183
    Melbourne
    Home Country
    Australia Australia
    MediaPortal Version: 2.0.0.0
    Windows Version: Windows XP Pro SP2
    CPU Type: AMD AthlonXP 2600+
    HDD: Seagate 160gb PATA & Seagate 80gb PATA
    Memory: 2x256mb DDR
    Motherboard: Asus A7N8X-X
    Motherboard Chipset: nForce2 400
    Motherboard Bios:
    Video Card: Gigabyte Radeon 9600 128mb
    Video Card Driver: DX9.0c & Catalyst 6.6
    Sound Card: Realtek ALC650 6CH
    Sound Card Driver: 6.14.462
    1. TV Card:
    1. TV Card Type:
    1. TV Card Driver:
    2. TV Card:
    2. TV Card Type:
    2. TV Card Driver:
    3. TV Card:
    3. TV Card Type:
    3. TV Card Driver:
    4. TV Card:
    4. TV Card Type:
    4. TV Card Driver:
    MPEG2 Video Codec: MPV
    MPEG2 Audio Codec: MPA
    Power Supply: Generic 400 Watt
    Remote: Microsoft MCE (Aus)

    I've been using MP on my HTPC for ages now, but I've just installed it on my main PC to try my hand at some development.

    I'v tried re-installs and I've tried applying updates, but I can't get it to work.

    MP starts but the main window is empty, it just shows the desktop behind it. If I move the window it holds whatever was behind it when it started. That is to say, it's not a hollow window frame and it's not refreshing.

    When I looked at the error log I found that GDI+ was throwing an exception. I don't think this is a bug with MP, I expect it's a setup problem with my PC. I've run a heap of updates and patches but nothing seems to fix it.

    I'm in the middle of extending the MCE remote code to support BZR's alternative driver, but I can't go any further until I get this sorted.

    http://pastebin.team-mediaportal.com/10600

    Cheers,
     

    mPod

    Portal Pro
    January 26, 2005
    2,084
    3
    Berlin
    Home Country
    Germany Germany
    Usually such is caused by some (broken) windows font. MP uses them and if one of them is broken, that error comes up. Hard to find out if that's also the case with your system and which font is causing it. You probably don't wanna hear it, but users with the same problem solved it by reinstalling XP.

    It even might be one of your installed applications which exchanged a windows font. But that's just a guess.
     

    and-81

    Retired Team Member
  • Premium Supporter
  • March 7, 2005
    2,257
    183
    Melbourne
    Home Country
    Australia Australia
    Not the end of the world. I've got an XP Pro SP2 + Updates slipstreamed installed CD here that I can do a repair with. Hopefully that will do the trick.

    However, I do have Visual C# Express installed due to the tinkering I'm doing. I could run MP debug and see if I can narrow down the font problem if you think it might help others?
     

    mPod

    Portal Pro
    January 26, 2005
    2,084
    3
    Berlin
    Home Country
    Germany Germany
    Not the end of the world. I've got an XP Pro SP2 + Updates slipstreamed installed CD here that I can do a repair with. Hopefully that will do the trick.

    However, I do have Visual C# Express installed due to the tinkering I'm doing. I could run MP debug and see if I can narrow down the font problem if you think it might help others?
    Of course! Well, it could be that there is something that can be done/fixed/worked around in MediaPortal. Just hard to say, cause nobody of the team suffers from it. And users who reported it were able to solve it by reinstalling XP or finding out what font caused an error.

    So if you can debug it and maybe find out what's going on behind the scenes, other users will benefit from it. E.g. the one who's post you answered. ;)

    So "font" could be a hint. Not saying that necessarily it is the same problem for you. But that only you can tell at the moment, as it seems. I'll keep my thumbs pressed that you hopefully can find out more about this mysterious error.
     

    and-81

    Retired Team Member
  • Premium Supporter
  • March 7, 2005
    2,257
    183
    Melbourne
    Home Country
    Australia Australia
    Possible fixes

    I've tracked down the problem. Well, for me at least.

    It seems to me that when MP loads it creates bitmaps of the fonts that are used by the current skin, if they don't already exist. BlueTwo requests Arial, Courier New and Dingbats.

    When the bitmap is being created MP gets GDI+ to draw each character in the font onto a graphics context. One at a time. Like this:

    for (char c = (char)_StartCharacter; c < (char)_EndCharacter; c++)
    ...

    Now, the problem occurs when it starts processing dingbats and gets up to "c = 127", because there is no character 127 in the dingbats font I have. GDI+ throws a rather useless exception and the whole thing goes off the rails.

    I've found two possible solutions:

    1. Delete the dingbats font. Which works for me, and I've asked mike061960 to try as well and get back to me on.

    or

    2. Make a change to MediaPortal.GUI.Library GUIFont.cs to catch the GDI+ exception and skip over any characters that cause it. I've attached my modified GUIFont.cs file to this post for consideration. The change is in the PaintAlphabet method at the end of the file.

    I'd like to be a bit smarter about it and actually detect when the font doesn't contain a particular character and avoid calling the DrawString operation that causes the exception, but I've searched high and low and haven't found a way to do that yet. In the meantime this looks like a reasonable fix to me.

    Also worth noting, My HTPC which has been running MP happily for a very long time now doesn't have the dingbats font installed. It's been rebuilt a couple of times over the years and is currently running XP Pro SP2 + Updates.

    However, BlueTwo uses dingbats in two places. BasicHome.xml and mytvFullScreen.xml

    But here is a list of Windows XP fonts (probably a good resource for skinners):
    http://www.microsoft.com/typography/fonts/winxp.htm

    Notice, there is no dingbats.

    Looking at the properties of the dingbats font I found this:

    "Copyright URW Software, Copyright 1997 by URW"

    (PM me if you want more "info" on the font)

    So should BlueTwo be requesting this font if it's not a standard WinXP font?

    Sorry for the long post. Just trying to get in all the details.

    Hope that helps.

    Cheers,
     

    mPod

    Portal Pro
    January 26, 2005
    2,084
    3
    Berlin
    Home Country
    Germany Germany
    Thanks for all these investigations.

    I found out that in fonts.xml the "Dingbats" fonts is defined. As this font is not part of XP anyway, as you already said correctly, it defaulted to "Arial" on all other systems. That's why only some people experienced this bug. From now on Dingbats is no longer used in BlueTwo. This should fix the crash.

    We're looking into your fix for the error handling as well, tho. Thanks!
     

    and-81

    Retired Team Member
  • Premium Supporter
  • March 7, 2005
    2,257
    183
    Melbourne
    Home Country
    Australia Australia
    My pleasure.

    It's actually rather criminal that I haven't tried contributing to MP until now.

    Also, I should have something for BZR's alternate MCE remote driver soon. I've got it working, but it's a bit of a hack. I know this is off-topic, but what is the procedure for submitting code to be looked at by the real devs?
     

    mPod

    Portal Pro
    January 26, 2005
    2,084
    3
    Berlin
    Home Country
    Germany Germany
    I know this is off-topic, but what is the procedure for submitting code to be looked at by the real devs?
    Submit it to the patches section of sourceforge. Make sure to always include full files, no diffs.

    But if you think it's more a hack than some "good" code, work a bit more on it, please. ;)
     

    Users who are viewing this thread

    Top Bottom