Georg Wünsch wrote:
> Hi everybody,
> 
> please help me, I switched to VS 2008 Express Edition with Windows SDK 
> on Vista. I am using QT 4.4.1 with makespec=win32-msvc2008, 
> "opensg_dailybuild.080812.i686-pc-cygwin.cl.net2005.OpenSG-1.8.0-cl.net2005". 
> 
> 
> I am not using QT4Windows at all but passive windows, so there should be 
> no interference with QT and OpenSG. Every package of my projekt compiles 
> correctly with VC 90, but opensg seems to bring in link dependencies to 
> VC 80. This results in the application not linking or not starting - 
> neither release nor debug build. Under Vc2005 everything was running 
> stable. I am trying now for a week to solve the problem, but I am 
> totally lost. What I have tried so far is:
> 
> 1. build the application against VC 90 --> linker error between OpenSG, 
> QT and vc 90 as some of it uses msvcr80 and some msvcr90  (?)
> Unfortunately I have static libs in my probgram that use calls to dlls 
> of opensg and qt within one lib. I guess the linker does not know which 
> msvcrt version to link to? Am I right at this point or should this work?

Could you post some specific output from your linker errors?

It should work. Remember to use exactly the same runtime libs 
(multithreaded debug/release) in all your libs/exes/dlls!

Detail: This is only important if they free eachothers memory (which 
happens if you pass a std::string by value, for instance.) Thus OpenSG 
and your app needs to use the same runtime. I don't know how QT does it. 
(As a counter-example, the Xerces C++ parser doesn't allow lib clients 
to free memory it has allocated, so it can use msvc80 while the user-app 
uses msvc90).

> 2. rebuild OpenSG 1.8 using scons --> vc90 build options seems not to 
> work in SConstruct script Does anyone have a Version which works with 
> OpenSG 1.8, Vista and VC90? (Marcus Lindblom, I guess You were working 
> on that?)

So far I haven't tried our app on Vista (but that's easy to test). 
However, I am running things successfully under VC90 and OpenSG 1.8 as 
of 2008-08-12.

But the Sconstruct file in CVS did have msvc90 stuff, so I really didn't 
do very much. Are you sure there's no support for it?

Run 'scons --help' and look at the 'compiler' lines. The last entry in 
my row is msvc90. (I did not add this myself)

> 3. build the application against VC 80 --> compile and link works, 
> application is not running stable any more, as my QT version seems to 
> have dependencies to VC90 dlls

True. That could cause some problems.

> Currently I am trying to build everything (QT and external libs and the 
> application + use opensg18 dailybuild) against VC 80 while using VS2008 
> als IDE. But that is no solution in the long run.
> 
> 
> Another Question to OpenSG programming:
> 
> I have a Scene in "NodePtr mScene", other parts of my program are 
> refering to Nodes within the scene using "NodePtr mNode". Now I would 
> like to delete the scene:
> 
> What should I do to avoid a program crash and memory leaks:

Simple: Always use XXXRefPtr to store OSG-objects. Never do add/subref 
yourself.

Then you can clear the pointer by setting it to null (NullFC).

Read up on reference-counting. Note that XXXPtr is not reference 
counted, but XXXRefPtr is.

[snip]

> What happens to the references (mNode) to parts of the scene once I 
> delete the scene? Will they be kept preserving parts of the scene or 
> will they be deleted (set to NullFC) or will they still point to freed 
> memory resulting in a crash later on? Should the way to delete the scene 
> be rather: first delete all references to nodes in the scene, then 
> delete the scene? how should the "delete" look like (see above).

When there are no more RefPtr's pointing to an object it is deleted.
(This happens because when a refptr no longer refs an objects, it 
decrements it's refcount, and when it becomes zero, there are no more 
refs to it, so it is deleted.)

Deleting that object will decrement reference-counts of other objects 
that the object referenced. Thus you get a whole chain of object 
deletions, which is what you want.

I think this is in the tutorials. It's really not that tricky, except 
that you'll have to watch out for:
  1. cycles (not an issue with OpenSG, it's written quite well against 
that.)
  2. osg-objects not using ref-counts internally (only in 1.x AFAIK, 
especially some Viewport classes). So, if you store things in refptr and 
they are destroyed before opensg's objects, you may get crashes there.

mvh
/Marcus


-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Opensg-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensg-users

Reply via email to