plugin with STL + sdk C4D 10 = crash



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 30/08/2007 at 11:25, xxxxxxxx wrote:

    User Information:
    Cinema 4D Version:   10 
    Platform:      Mac OSX  ; 
    Language(s) :     C++  ;

    ---------
    Hi all! 
       I've made a simple filter plugin (UB) with STL (std::vector and std::map) on Mac OS X (10.4.10)
       This plugin was compiled under Xcode 2.5 and run fine under PPC machines (G5) but always crashes at startup on MacIntel machines (iMac 2Ghz).
       Xcode does not detect errors with my C++ sources. And the project uses same build options as Cinema4D sample (cinema4dsdk).
       I guess a mismatch between C4D "new/delete" and STL allocators ...
       Does anyone get this kind of problem ?  
    Any help would  be very appreciated.
    Wopr.



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 31/08/2007 at 10:18, xxxxxxxx wrote:

    For all practical purposes, the following crash log is generated by Cinema4D Demo r10 using my plugin on MacIntel machines (with rosetta mode).
    I don't know why "GeFree" is called by the Apple System framework.
    It sounds like Cinema4D memory allocator override core system library.Why?
    Please Help.
    --------------------------------------------------------------------------
     
    Thread 2: Crashed (0xb7fffabc, 0x7eca02eb)
    0x004f3538: /Applications/CINEMA 4D R10.1 Demo/CINEMA 4D Demo.app/Contents/MacOS/CINEMA 4D Demo : __Z7_GeFreePPv + 0x98
    0x0038ab28: /Applications/CINEMA 4D R10.1 Demo/CINEMA 4D Demo.app/Contents/MacOS/CINEMA 4D Demo : __Z7XGeFreePv + 0x18
    0x915c6580: /System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/AE.framework/Versions/A/AE : _AEDisposeDesc + 0xf8
    0x915c5798: /System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/AE.framework/Versions/A/AE : _aeProcessAppleEvent + 0x1c4
    0x93214a94: /System/Library/Frameworks/Carbon.framework/Versions/A/Frameworks/HIToolbox.framework/Versions/A/HIToolbox : _AEProcessAppleEvent + 0x38
    0x0001641c: /Applications/CINEMA 4D R10.1 Demo/CINEMA 4D Demo.app/Contents/MacOS/CINEMA 4D Demo : __Z13DoAppleEventsP25OpaqueEventHandlerCallRefP14OpaqueEventRefPv + 0x7c
    0x93210c9c: /System/Library/Frameworks/Carbon.framework/Versions/A/Frameworks/HIToolbox.framework/Versions/A/HIToolbox : __Z23DispatchEventToHandlersP14EventTargetRecP14OpaqueEventRefP14HandlerCallRec + 0x3e0
    0x932102a0: /System/Library/Frameworks/Carbon.framework/Versions/A/Frameworks/HIToolbox.framework/Versions/A/HIToolbox : __Z30SendEventToEventTargetInternalP14OpaqueEventRefP20OpaqueEventTargetRefP14HandlerCallRec + 0x160
    0x93210120: /System/Library/Frameworks/Carbon.framework/Versions/A/Frameworks/HIToolbox.framework/Versions/A/HIToolbox : _SendEventToEventTargetWithOptions + 0x28
    0x93217b74: /System/Library/Frameworks/Carbon.framework/Versions/A/Frameworks/HIToolbox.framework/Versions/A/HIToolbox : __Z29ToolboxEventDispatcherHandlerP25OpaqueEventHandlerCallRefP14OpaqueEventRefPv + 0x138
    0x93210fb4: /System/Library/Frameworks/Carbon.framework/Versions/A/Frameworks/HIToolbox.framework/Versions/A/HIToolbox : __Z23DispatchEventToHandlersP14EventTargetRecP14OpaqueEventRefP14HandlerCallRec + 0x6f8
    0x932102a0: /System/Library/Frameworks/Carbon.framework/Versions/A/Frameworks/HIToolbox.framework/Versions/A/HIToolbox : __Z30SendEventToEventTargetInternalP14OpaqueEventRefP20OpaqueEventTargetRefP14HandlerCallRec + 0x160
    0x93217a18: /System/Library/Frameworks/Carbon.framework/Versions/A/Frameworks/HIToolbox.framework/Versions/A/HIToolbox : _SendEventToEventTarget + 0x28
    0x00016620: /Applications/CINEMA 4D R10.1 Demo/CINEMA 4D Demo.app/Contents/MacOS/CINEMA 4D Demo : __Z14MacMessageLoopPVi + 0x1d0
    0x000198d0: /Applications/CINEMA 4D R10.1 Demo/CINEMA 4D Demo.app/Contents/MacOS/CINEMA 4D Demo : _main + 0x3b0
    0x0000903c: /Applications/CINEMA 4D R10.1 Demo/CINEMA 4D Demo.app/Contents/MacOS/CINEMA 4D Demo : __start + 0x2f8
    0x00008d40: /Applications/CINEMA 4D R10.1 Demo/CINEMA 4D Demo.app/Contents/MacOS/CINEMA 4D Demo : start + 0x30
    0x802fe18f: No symbol



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 03/09/2007 at 04:35, xxxxxxxx wrote:

    There can be problems like that on Windows, I am not sure if it's the same on the Mac.

    For the windows case, the problem is that CINEMA overrides the new & delete operators. The problem is, that this override happens after any global constructors are called. If there's memory allocated in a constructor that is called in the global scope, memory gets allocated by the original memory management, which afterwards is replaced.

    Do you use any global class instances (be it STL or your own stuff) that might allocate memory in the constructor? I have had this happen with global std::string instances, I think streams are sometimes problematic, too.

    Hope that helps!
    Timm



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 03/09/2007 at 11:20, xxxxxxxx wrote:

    Thanks tdapper!
    My code doesn't allocate any memory chunk in constructors (globals or statics).
    The weird thing is once I put some STL code (only declarations) I got this bug. 
    The very strange thing is "GeFree" is called on Cinema4D startup from Apple System framework, ONLY on i386 machines (iMac), not on PPC (neither on the Windows version).
    Maybe there is some mismatch with linked libraries or compilations options(C4D/gcc). I don't know.
    is there a way to deactivate (properly) the C4D new/delete overriding ?
    It would be very nice if Cinema4D SDK developers can investigate this
    strange bug. We're on dev support forum, isn't it?
    So, I'm still waiting for the support from SDK team.



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 03/09/2007 at 12:01, xxxxxxxx wrote:

    Hi!

    There is no way to override this behaviour. I wouldn't count for the SDK to be changed, so it makes sense to narrow down the problem. Can you tell which lines of code exactly bring up the problem and post them? That'd probably be helpful in figuring out a workaround.

    Best
    Timm



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 05/09/2007 at 00:32, xxxxxxxx wrote:

    Just create a "empty filter plugin" (release mode) for C4D 10. Add some STL code (std::map, std::vector, std::string). Build/Run on iMac.
    Crash at C4D startup.



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 05/09/2007 at 00:38, xxxxxxxx wrote:

    Quote: Originally posted by wopr33 on 05 September 2007
    >
    > * * *
    >
    > Just create a "empty filter plugin" (release mode) for C4D 10. Add some STL code (std::map, std::vector, std::string). Build/Run on iMac.
    >
    > Crash at C4D startup.
    >
    >
    >
    >
    > * * *

    Hi there!

    You'd need to be more specific. Where do you add the code? Please really post an example (even if it is dead simple).

    I am having quite a few CINEMA Plugins that make heavy use of STL and that work just fine on the Mac.

    Timm



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 05/09/2007 at 01:12, xxxxxxxx wrote:

    Same here. I use STL all the time and never got crashes due to it, either on PC nor on MAC PPC/Intel...except I made a mistake. ;)

    code would be useful.



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 17/09/2007 at 05:15, xxxxxxxx wrote:

    Hi all!
      We've finally give up this problem. Actually our plugin runs perfectly on Betatesters's MacIntel machines.
    But the plug is still buggy on our dev machines. We guess, it's a install problem from XCode/C4D SDK conflicts. Maybe.
    Thanks for your support.



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 06/12/2008 at 11:25, xxxxxxxx wrote:

    I'm encountering similar problems with crashiness using std::vector<t>. These are declared as class members, so I take it that the constructor part doesn't matter as these are instantiated with the class creation directly (same problem, different place).

    Unfortunately, the code being used is from another source and uses std::vector rather extensively. I'd rather not have to rewrite all of the code to use something else (like GeDynamicArray) - and I don't know how converting here might change the behavior of the code!



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 06/12/2008 at 15:25, xxxxxxxx wrote:

    For some reason, my newest code isn't crashing without even changing it much. Ignore my last reply. :)


Log in to reply