RE: XSI 6 crashes, new bug ?

Date : Fri, 27 Apr 2007 11:12:43 -0400
To : <XSI(at)Softimage.COM>
From : "Stephen Blair" <Stephen_Blair(at)Softimage.COM>
Subject : RE: XSI 6 crashes, new bug ?
Hi
 
Why don't you use Factory::CreateObject() like Bernard and Alan (line 870 in splish.cpp) suggest?


From: owner-xsi(at)Softimage.COM [mailto:owner-xsi(at)Softimage.COM] On Behalf Of Christopher Crouzet
Sent: Fri 27 April 2007 11:00 AM
To: XSI(at)Softimage.COM
Subject: Re: XSI 6 crashes, new bug ?

Well, sorry Alan but I didn't found any answer in your plugin.
As I have a really poor english, I think I didn't made me clear. To be concise, here is the problem : when I remove the property by using the 'DeleteObj' command within the 'siOnClosed' PPGEvent, XSI 6.0x will sometimes crashes.
I'm 95% sure that it's a XSI 6.0x bug which needs to be fixed, as all works fine in XSI 5.1.

Jason, the PPG is already inspected using the 'siLock' parameter, and my test scene is clear, so I haven't any object in selection nor any property open.


Thanks for the answers,
Christopher.

On 4/27/07, Jason Brynford-Jones <jasonbj(at)softimage.com > wrote:
Do you have an object selected AND a PPG open at the same time , which is set to recycle? 
 
I recently had this problem and found out that it was related to the callback not finishing as the new object had populated the PPG.
 
1    When opening the PPG - set it to Locked
or
2    The workaround suggested was to have a timer event which (in your case deletes the temp PPG).  So instead of Close - UnMute your timer, (whose callback closes the PPG) then ReMute it again.
 
If this is not what you meant - then think of it as advanced warning for when you come accross this issue :-)
 
Chinny
 
 
 
 

From: owner-xsi(at)Softimage.COM [mailto: owner-xsi(at)Softimage.COM] On Behalf Of Christopher Crouzet
Sent: April 27, 2007 6:26 AM
To: XSI Mailing List
Subject: XSI 6 crashes, new bug ?

Hello everyone,
I'm actually writing a custom property in C++, and I just found what looks like a bug.
The property is intended to be temporary, so I'm calling the 'DeleteObj' command within the 'siOnClosed' PPGEventContext to destroy the property when the user has finished to interact with it.
By doing this, XSI 6 randomly crashes... sometimes after 3 tries, sometimes after 20, but it always crashes.


Below is a code example to reproduce the problem by calling a few times the 'crashy' command.

// Start code.

XSIPLUGINCALLBACK CStatus crashy_Execute(CRef &in_ctxt)
{
    Context ctxt = in_ctxt;


    Application app;
    Factory factory = app.GetFactory();
    CRef refProp = factory.CreateObject(L"crashyProp");

    CValueArray inArgs(5);
    inArgs[0] = refProp;
    inArgs[3] = siLock;
    inArgs[4] = false;

    CValue outVal;

    app.ExecuteCommand(L"InspectObj", inArgs, outVal);


    return CStatus::OK;
}

XSIPLUGINCALLBACK CStatus crashyProp_PPGEvent(const CRef &in_ctxt)
{
    PPGEventContext ctxt = in_ctxt;
    PPGEventContext::PPGEvent ppgEvent = ctxt.GetEventID ();

    if (ppgEvent == PPGEventContext::siOnInit) {
        CustomProperty customProp = ctxt.GetSource();

        ctxt.PutAttribute(L"Close", true);
    }
    else if (ppgEvent == PPGEventContext::siOnClosed) {
        CustomProperty customProp = ctxt.GetSource();


        CValueArray inArgs(1);
        inArgs[0] = customProp;

        CValue outVal;

        Application().ExecuteCommand(L"DeleteObj", inArgs, outVal);
    }


    return CStatus::OK;
}

// End.



It perhaps looks strange to call the deletion of an object within the callback of the object itself, but there is a similar code in the doc (PluginRegistrar Class Reference).
And this code works fine in XSI 5.1, and crashe onnly with XSI 6.0 and XSI 6.01, so the code should be OK I think.

So, is it a new bug introduced since v6 ?
Does anyone have a workaround ?


Thanks !
Christopher.


Search the XSI List archives here or use the advanced search form to search across mailing lists. Searching help is available.
This site supposedly brought to you by Benjamin Grosser and the Imaging Technology Group.