Mailing List archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[vdr] Re: OSD and patterns



Jouni Karvo wrote:
> 
> hello,
> 
> I was carried away a bit on the pattern stuff of the emails today and
> looked at your osd source.  It seems to me that the cOsdProvider class
> is meant to control creation of the actual cOsd classes.  However,
> currently the constructors of cOsd and sDvbOsd are public, so it is a
> possible place for a future bug. (If I understood correctly.) I suggest
> that those methods would be made protected and the cOsdProvider class
> made a friend.

I'll put the whole cDvbOsd declaration into dvbosd.c, so noone can directly
create an object of that class.

Since the basic cOsd has no real functionality regarding the access of actual
OSD hardware, making its constructor protected is certainly not a bad idea.
I'll also make cOsdProvider return NULL if NewOsd() is called while there
is still an OSD open (cOsd::IsOpen() provides that information).

> Another thing that came to my mind is to use the proxy pattern as an
> intelligent pointer for cOsd so that the user of the OSD would not
> need to take care of explicitly deleting it but it would be deleted
> automatically whenever no-one has a pointer to it any more.  I'm not
> sure if this is the best thing to do in this case, but if you are
> interested, I could try to find time to provide a patch for it.

Since at any time only the one who has actually created a cOsd should
have access to it, this approach would be feasible.

Klaus




Home | Main Index | Thread Index