Help - Search - Members - Calendar
Full Version: new sdk = problems
Hydrogenaudio Forums > Hosted Forums > foobar2000 > Development - (fb2k)
musicmusic
It goes through here:
QUOTE
inline void copy(t_source * p_ptr) throw() {
m_ptr->service_release_safe();
m_ptr = p_ptr;
m_ptr->service_add_ref_safe();
}


Now m_ptr is NULL at first line.

service_release_safe looks like this:
QUOTE
void service_base::service_release_safe() throw() {
if (this != NULL) service_release();
}

But when it gets there the this pointer is 8, not 0.

After lots of tracking down why it doesn't happen everywhere, I found the reason the this ptr was 8 and not NULL, as explained by this simple testcase:
CODE
        class t_base
        {
            t_uint32 a;
            virtual int & myvfunc()=0;
        };

        class myserviceimpl : public t_base, public user_interface
        {
            t_uint32 hjh;
        };

        service_ptr_t<myserviceimpl> test1;
        service_ptr_t<myserviceimpl> test2(test1);


Good day
Peter
A fix will be included in next revision of the SDK. Current service_ptr_t implementation expect service_base pointer of your class to be physically equal to your class pointer; anything else will cause problems. I'll try to hunt down all cases of this breaking (I believe that there is more, anything with templated pointer casts and NULL pointer checks is affected).

For now, I suggest that you change your code to derive from user_interface first (as for above test case) and then from the other class, like all other service implementations do.
musicmusic
QUOTE(Peter @ Jun 19 2006, 11:49) *

A fix will be included in next revision of the SDK.

I see. Thanks.

QUOTE(Peter @ Jun 19 2006, 11:49) *
I'll try to hunt down all cases of this breaking (I believe that there is more, anything with templated pointer casts and NULL pointer checks is affected).
I didn't encounter any problems before 2006-06-15 SDK, I didn't understand the change to checking this != NULL from old m_ptr != NULL method either (some wierd optimisation?).

QUOTE(Peter @ Jun 19 2006, 11:49) *
For now, I suggest that you change your code to derive from user_interface first (as for above test case) and then from the other class, like all other service implementations do.
Or revert to 0.9.2 SDK. What is meant to be new in 2006-06-15 SDK that needed urgent release? (Vista compatibility..?)
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2008 Invision Power Services, Inc.