Maxon Developers Maxon Developers
    • Documentation
      • Cinema 4D Python API
      • Cinema 4D C++ API
      • Cineware API
      • ZBrush Python API
      • ZBrush GoZ API
      • Code Examples on Github
    • Forum
    • Downloads
    • Support
      • Support Procedures
      • Registered Developer Program
      • Plugin IDs
      • Contact Us
    • Categories
      • Overview
      • News & Information
      • Cinema 4D SDK Support
      • Cineware SDK Support
      • ZBrush 4D SDK Support
      • Bugs
      • General Talk
    • Unread
    • Recent
    • Tags
    • Users
    • Login

    Bug hunting help

    SDK Help
    0
    7
    487
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • H
      Helper
      last edited by

      On 03/08/2013 at 22:44, xxxxxxxx wrote:

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

      ---------
      I am working on a C++ plugin that requires this object hierarchy:
      Null
      Object1
      Object2
      Object3

      This plugin has two parts:

      1. a scene exporter (SceneSaverData)
      2. a tool plugin which helps creating and setting up the hierarchy in the correct way

      Both parts are in the same Xcode project.

      I have spent the last few weeks working on the tool plugin part and today I finally was ready to resume work on the exporter. But now, when I try to export C4D hangs with the beach ball. The crash report says Bad Access. This didn't happen before.

      Here is the mysterious part (at least to me) :
      This project is plastered with GePrint's that show what's going on in my plugin and where it's at. Right at the top of my SceneSaver code it prints "here I am" to the console.
      Then it checks my hierarchy and prints errors if it doesn't find the expected objects.
      ->When I have the hierarchy as it should be (above) I get the crash - and none of the messages that are supposed to be printed to the console before anything else happens in the SceneSaver suggesting that the crash happens before it enters my code.
      ->When I run the SceneSaver on the same hierarchy MINUS the last child (Object3) I get all the expected messages plus the one that says: "Object3 missing" and the plugin exits properly.

      How could the presence of Object3 in the hierarchy crash C4D before it even gets to my code?
      ->Maybe something I did in the tool plugin. Compiling a version where the tool plugin is not registered doesn't change things, though.

      I don't know how to troubleshoot this one because the crash doesn't seem to happen in my code - even though it surely happens because of it. So far the only idea I have is to go back to an older version which doesn't have that problem.

      Any ideas are most welcome.

      Thanks

      Peter

      1 Reply Last reply Reply Quote 0
      • H
        Helper
        last edited by

        On 04/08/2013 at 04:08, xxxxxxxx wrote:

        Do you get the crash also if you create the hierarchy manually and then export it with your plugin? Are you doing any scene modifications in your SceneSaver?
        If the program only crashes when using the tool maybe you just forgot to remove the object3 from the document before you inserted it under object2?
        It's always useful to post some code especially in your case.

        1 Reply Last reply Reply Quote 0
        • H
          Helper
          last edited by

          On 04/08/2013 at 09:23, xxxxxxxx wrote:

          Perhaps GePrint first writes to a buffer before the buffer is eventually dumped to the console. Better use GeDebugOut instead.

          1 Reply Last reply Reply Quote 0
          • H
            Helper
            last edited by

            On 04/08/2013 at 09:51, xxxxxxxx wrote:

            Yes I get the crash if I make my hierarchy by hand. Also using various object types in the process doesn't change it. As soon as I drag that last object (Object3) out from "under" Object2 it works normally. I didn't know about GeDebugOut. Will have to explore that.

            I understand that posting code might help. Except that I don't know what to post since I have no clue what is doing this.

            I'll go back to earlier versions today and see....

            Thanks

            1 Reply Last reply Reply Quote 0
            • H
              Helper
              last edited by

              On 04/08/2013 at 09:57, xxxxxxxx wrote:

              One little detail I forgot to mention:
              In order for the exporter to "find" my hierarchy it does this:
               op = GetFirstSelectedNullObject(doc);
              As expected, when nothing is selected or the wrong object, I get an error message and no crash even though the complete hierarchy is there.

              1 Reply Last reply Reply Quote 0
              • H
                Helper
                last edited by

                On 04/08/2013 at 10:09, xxxxxxxx wrote:

                Assuming GePrint is not necessarily reliable (because of buffering) I stripped some more code from the exporter and it looks like at some point it does a op->Remove() where the op is not there. I guess I prime example for BAD_ACCESS.

                Thanks

                1 Reply Last reply Reply Quote 0
                • H
                  Helper
                  last edited by

                  On 06/08/2013 at 07:08, xxxxxxxx wrote:

                  Howdy,

                  A good thing for you to do is to set a breakpoint in your exporter code and use the Xcode debugger to step through the code and look at the values of the local variables. 😉

                  Adios,
                  Cactus Dan

                  1 Reply Last reply Reply Quote 0
                  • First post
                    Last post