Crash of Cinema4D with UB migration



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

    On 19/02/2006 at 08:47, xxxxxxxx wrote:

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

    ---------
    Here is the 'dump' - note the crashing method:

    _Date/Time:       2006-02-19 08:32:43.777 -0700
    OS Version:     10.4.5 (Build 8H14)
    Report Version: 4

    Command: CINEMA 4D
    Path:    /Applications/MAXON/CINEMA 4D R9.5.2 UB/CINEMA 4D UB.app/Contents/MacOS/CINEMA 4D
    Parent: WindowServer [60]

    Version: 9.521 (9.521)

    PID:    932
    Thread: 0

    Exception: EXC_BAD_ACCESS (0x0001)
    Codes:      KERN_PROTECTION_FAILURE (0x0002) at 0x000000b0

    Thread 0 Crashed:
    0   com.maxon.cinema4d                  0x003c6d40 BoGetTagData(BaseObject*, long, long) + 128
    1   interPoser Ltd.dylib                0x0780e324 AnimLoader::Begin(BaseDocument*, AtomArray*, Filename, String, long, long, long, long, float, unsigned char, unsigned char) + 3172
    2   interPoser Ltd.dylib                0x0781e44c iPDialog::LoadScene(unsigned char) + 3708
    3   interPoser Ltd.dylib                0x07821e2c iPDialog::Command(long, BaseContainer const&) + 2524
    4   interPoser Ltd.dylib                0x07861f54 CDialogCallBack(CDialog*, CUserArea*, BaseContainer* ) + 164
    _

    The only tag access in AnimLoader::Begin() is here:

                   // Create a new PLA Key set  
                   // - Add KeyFrame  
                   if (!(key = PLAKey::Alloc()))  
                   {  
                        retval = ErrorException::Throw(GeLoadString(ERROR_MEMORY_TEXT), "AnimLoader.CreateKeyFrame.key");  
                        goto Catch;  
                   }  
                   key->SetTime(stime);  
                   list->seq->InsertKey(key);  
                   destDoc->AddUndo(UNDO_NEW, key);  
                   // - Add PLA data  
                   if (!(vtag = key->GetPointTag()))  
                   {  
                        retval = ErrorException::Throw(GeLoadString(ERROR_MEMORY_TEXT), "AnimLoader.CreateKeyFrame.vtag");  
                        goto Catch;  
                   }  
                   // - Update array size of vtag  
                   vc.old_cnt = vtag->GetDataCount();  
                   vc.new_cnt = list->ptCnt;  
                   if (!vtag->Message(MSG_POINTS_CHANGED, &vc;))  
                   {  
                        retval = ErrorException::Throw("AnimLoader.CreateKeyFrame","PLA data creation failed");  
                        goto Catch;  
                   }  
    #ifdef WIN64  
                   CopyMem(((PointObject* )obj)->GetPoint(), vtag->GetDataAddress(), static_cast<VLONG>(list->ptSize));  
    #else  
                   CopyMem(((PointObject* )obj)->GetPoint(), vtag->GetDataAddress(), list->ptSize);  
    #endif
    

    And, of course, this code has worked in Windows, Windows x64, and MacOS for some time. Anything changed that I should know about and not mentioned in the 9.52 SDK documentation?

    Thanks,
    Robert



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

    On 22/02/2006 at 11:46, xxxxxxxx wrote:

    Is perhaps obj==NULL at the CopyMem() line? In that case it would be interesting to know where the obj value comes from.



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

    On 22/02/2006 at 12:59, xxxxxxxx wrote:

    That is possible. And the only possible way that would occur is if the document is loaded empty (read: incorrectly because of Xcrud)!

    Here's the section of code above the code in the first post:

         for (startf; startf <= endf; startf += nthf)  
         {  
              stime = BaseTime::BaseTime(insertion, fps);  
              insertion += spacing;  
              fn.SetFile(Filename(animRoot+LongToString(startf)));  
              fn.SetSuffix("obj");  
              // Import Wavefront Object file Name_<frame>.obj  
              if (!(frameDoc = LoadDocument(fn, FALSE)))  
              {  
                   retval = ErrorException::Throw(GeLoadString(ERROR_READFILE_TEXT), fn.GetString());  
                   goto Catch;  
              }  
              // For each object in scene  
              obj = frameDoc->GetFirstObject();  
              for (list = slist; list != elist; list++)  
              {  
    

    I could be pedantic and check for obj, but the way this works, loading a set of Wavefront OBJ files from Poser, it should never be the case under non-ridiculous circumstances.

    As stated already, this is code that has worked for more than a year on Windows and MacOS as well as Windows x64 more recently. There are hundreds of registered users and thousands of demo users. And, believe me, there are objects in them there documents that I'm loading - same test files since the end of the year before last.

    This mess is XCrud at its best.

    But I don't think it involves CopyMem(), except for maybe vtag->GetDataAddress(). Note that the crashing method is 'BoGetTagData()' - this is one of yours. There is no direct call to GetTagData() or anything similar in this code.

    Thanks,



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

    On 25/02/2006 at 14:49, xxxxxxxx wrote:

    You could try with LoadDocument(fn, TRUE) to see if it gives any error. But it sounds like there might be a bug in the OBJ importer in the UB version. Could you see if it happens with all OBJ files? Does it also fail if you open it directly with C4D?
    It seems unlikely that this error would be caused by the Xcode installation at your end. (I assume you are refering to Xcode as "Xcrud" in the above post.)
    The call to BoGetTagData() is likely in obj->GetPoint(), which is why I believe it's NULL. (As you say, obj shouldn't be NULL here in normal circumstances. However, one reason never to trust pointers in any circumstance is that checking them makes it easier to find where the problem lies. Rather than me having to do the debugging in my head...)



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

    On 25/02/2006 at 17:21, xxxxxxxx wrote:

    I will try that and check for a valid object pointer.

    Wouldn't BoGetTagData() be more likely to belong to vtag?

    But this will have to wait as I've just ported another plugin to MacOS (regular) and am working on another piece of fun (see new message).

    Thanks Mikael. When I get back to this, I will let you know what I find.

    P.S.: I'm calling it "XCrud" since this thing is a mess (still). I've seen the tens of thousands of confused developers streaming threads about the problems associated with creating Universal Binaries. It must be so excellent when one is able to talk directly to Apple support about difficulties and get these things cleared up. Such things are only available at a cost - something that Steve doesn't mention in his talk about the move. I still had not resolved my zlib (libz.dylib) problems last it was attempted. No ideas at all - well other than the endian guess. Endian stuff should be handled like Cinema 4D (something I do like about your SDK!). Instead they offer a complex process with dozens of methods. My simpler plugins migrated easily, but my biggest two are not for the feignt of heart (interPoser Pro currently compiles at 584KB on MacOS .xdl and it is barely using half of the available code!).


Log in to reply