TeletextPageRenderer crashes in Finalizer on MP-exit (1 Viewer)

zowie

New Member
July 7, 2008
2
0
Hannover
Home Country
Germany Germany
System:
TV-Server Version: 1.0.0.0 RC2
MediaPortal Version: 1.0.0.0 RC2
MediaPortal Skin: Default
Windows Version: Windows Vista SP1
CPU Type: Intel Q6600@2400
HDD: Western Digital 500GB
Memory: 4GB PC6400 GEIL
Motherboard: Gigabyte P35-DS3R
Video Card: nVidia Geforce 8800GTX
Video Card Driver: 175.16
Sound Card: Creative Audigy 2 Value
Sound Card AC3: no AC3
Sound Card Driver: 2.12.002
1. TV Card: Pinnacle PCTV 300i
1. TV Card Type: DVB-T
1. TV Card Driver: 6.0.6000.16420 via Windows Update
Power Supply: Seasonic
Remote: Microsoft
TV - HTPC Connection: DVI

Hello,

please have a look at this screenshot
It shows that the TeletextPageRenderer throws an Exception on exit, if Teletext is displayed, when you close MP.

Reproduction:
- Start MP 1.0.0.0RC2 as Debug-Version in Visual Studio
- Start TV
- Start Teletext
- Click Exit
-> ArgumentException
at System.Drawing.Graphics.CheckErrorStatus(Int32 status)
at System.Drawing.Graphics.FillRectangle(Brush brush, Int32 x, Int32 y, Int32 width, Int32 height)
at MediaPortal.TV.Teletext.TeletextPageRenderer.Clear()
at MediaPortal.TV.Teletext.DVBTeletext.ClearBuffer()
at MediaPortal.TV.Teletext.DVBTeletext.Finalize()

Suggestion:
It looks like resources are disposed in the DVBTeletext-finalizer. Usage of the Dispose pattern should fix the error.
As far as I know, finalize should be used in very rare circumstances only, because you cannot rely on anything in the world around you. In this case it seems that the graphics context is already gone, when finalize is called.
Another workaround could be to call DisposeBitMap on close, which sets _renderGraphics to null.
 

tourettes

Retired Team Member
  • Premium Supporter
  • January 7, 2005
    17,301
    4,800
    Looks like a valid bug. Can someone reproduce this? If yes then we need to add it into Mantis (currently I dont have access to the MP and most likely I'll forgot this error before morning so it would be good if someone could check this).
     

    johnzered

    Retired Team Member
  • Premium Supporter
  • April 20, 2008
    358
    80
    Home Country
    Finland Finland
    Yes, I can confirm this. I also did som investigation and found out that in TeletextPageRenderer.cs in TVPlugin and TVLibrary the method public void Clear() does exactly what public void DisposeBitMap() does in TeletextPageRenderer.cs in MP TVCapture source. Like this:

    public void Clear() {
    if (_pageBitmap != null)
    _pageBitmap.Dispose();
    _pageBitmap = null;

    if (_renderGraphics != null)
    _renderGraphics.Dispose();
    _renderGraphics = null;
    }

    so maybe the code Clear() in mp source need to be changed to the above or commented out and replaced with a call to public void DisposeBitMap() which already does the above. I tried to change it and didn't se any side effects but someone else should probably also take a look at this.

    //johnzered
     

    ronilse

    Retired Team Member
  • Premium Supporter
  • July 19, 2005
    4,422
    283
    Moss
    Home Country
    Norway Norway
    Hi,
    I'm not able to confirm this using dvb-t & teletext & latest SVN

    Regards
    Roy
     

    Users who are viewing this thread

    Top Bottom