Phil Endecott schrieb:
> Dear All,
> 
> I am finding the ++dfb library to be an effective way of accessing 
> directfb from C++, leading to nice simple code.  But I have encountered 
> some odd crashes.  A fairly minimal example is shown below.
> 
> The key point is that I pass *by value* an IDirectFB from the main 
> program to the load_pic function.  Similar things happen when I pass 
> other types by value.  But if I change to passing by reference it 
> works.  I fear that the "main" DirectFB is being destroyed when the 
> copy in the function is destructed.
> 
> Of course, passing a const reference is a little more efficient than 
> passing by value.  But I think that passing by value should work: it 
> looks as if the right sort of thing is going on in the reference 
> counting code, keeping only one underlying object.  Maybe there is some 
> subtle bug in there.  Or, maybe I have got the wrong idea.

I also encountered a ref counting problem in certain situations.

> So, can someone else try this example and see if it also fails for 
> them?  Do you agree that this ought to work?  Can anyone suggest a 
> debugging strategy?

We need to do stack traces of each Create/AddRef/Release and find out
which operators or constructors are to be implemented or maybe some
are superfluous?

-- 
Best regards,
   Denis Oliver Kropp

.------------------------------------------.
| DirectFB - Hardware accelerated graphics |
| http://www.directfb.org/                 |
"------------------------------------------"

_______________________________________________
directfb-users mailing list
[email protected]
http://mail.directfb.org/cgi-bin/mailman/listinfo/directfb-users

Reply via email to