Why this worked (prior to r11093) when compiled with vs2003 or gnu g++ (on
linux), I'm not sure..
On Fri, Dec 12, 2008 at 2:39 AM, Keith Kyzivat <kkyzi...@sipez.com> wrote:

> Aha! Alex and I found out the problem.
> The issue is that the MpResourceTopology::ResourceDef and
> MpResourceTopology::ConnectionDef structs were storing references...
>
> If you think about it -- these structs are initialized from a static
> array-of-structs initializer, where the UtlStrings are implicitly
> constructed from constant strings... so, the UtlString is constructed, the
> struct is constructed - and stores reference to the string, then, after the
> struct is constructed, UtlString goes out of scope, and gets implicitly
> deleted -- now struct holds invalid reference...
>
> I've fixed this now in rev 11093 -- and verified that
> sipXmediaAdapterLibTest unit tests run
>
> On Fri, Dec 12, 2008 at 12:34 AM, Paul Whitfield <pa...@omnitronics.com.au
> > wrote:
>
>> >> How do I run the Topology graph instead of the CallFlowGraph?
>> >
>> > Basically you should define following preprocessor defines for
>> > sipXmediaAdapterLib:
>> > DISABLE_DEFAULT_PHONE_MEDIA_INTERFACE_FACTORY
>> > ENABLE_TOPOLOGY_FLOWGRAPH_INTERFACE_FACTORY
>> >
>> > If you use Linux, then it can be done by passing --enable-topology-graph
>> > option to configure. Under Windows you have to change project's
>> > configuration. Btw, in VS6, VS2003 and VS2005 Debug builds
>> > Topology is enabled by default now. We should do the same
>> > for Release configurations too to avoid confusion.
>> >
>>
>>
>> When compiling with VS2008, with the definitions above, the
>> library crashes on initialisation.
>>
>> After much investigation today, it appears to be an issue
>> with how VS2008 initialises static classes.
>>
>> Specifically in
>>
>> spiXmediaAdaptorLib/CpTopologyGraphFactoryImpl.cpp,
>>
>> initalTopologyResources[] is set to a correct default values,
>> however, VS2008 appears to create temporary objects (on the stack)
>> and point to them.
>>
>> By the time initialTopologyResourcse is used they are out of
>> scope and they contain rubbish!. The same is true for the
>> other similarly initialised static classes/struct in this
>> file/mode.
>>
>> In the file MpResourceTopology.h there is a
>> #if defined(_MSC_VER) && ( _MSC_VER <= 1200 )
>> that prevents this on Visual Studio 6.0.
>>
>> However, it appears that it is also broken for VS2008..
>>
>> As a test, I modified this file so that
>> there where no statically initialised UtlString
>> objects.
>>
>> This fixed the initialisation issues, well at least the code started up
>> without crashing.
>>
>> For now I have gone back to using the MpCallFlowGraph rather
>> than MpTopology.
>>
>> So for the time being it appears that the Topology code is broken on
>> VS2008. :-(
>>
>> NOTE: I am not expecting anyone to fix this, I just want to make
>> sure that everyone knows about it to save anyone else having to
>> figure it out!
>>
>> Regards
>>
>>
>> Paul
>> _______________________________________________
>> sipxtapi-dev mailing list
>> sipxtapi-dev@list.sipfoundry.org
>> List Archive: http://list.sipfoundry.org/archive/sipxtapi-dev/
>>
>
>
>
> --
> Keith Kyzivat
>
> SIPez LLC.
> SIP VoIP, IM and Presence Consulting
> http://www.SIPez.com
> tel: +1 (617) 273-4000
>



-- 
Keith Kyzivat

SIPez LLC.
SIP VoIP, IM and Presence Consulting
http://www.SIPez.com
tel: +1 (617) 273-4000
_______________________________________________
sipxtapi-dev mailing list
sipxtapi-dev@list.sipfoundry.org
List Archive: http://list.sipfoundry.org/archive/sipxtapi-dev/

Reply via email to