Re: XSI 6 crashes, new bug ?

Date : Fri, 27 Apr 2007 13:48:16 +0200
To : XSI(at)Softimage.COM
From : "Christopher Crouzet" <christopher.crouzet(at)gmail.com>
Subject : Re: XSI 6 crashes, new bug ?
Hello Bernard,
thank for your answer.

'XSIFactory.CreateObject' is already the way I create this property, as you can see at the begin of the previous example.
I also tried to use the more "conventional" way with the 'AddProperty' method but the crashes still occurred.


Christopher.


On 4/27/07, Bernard Lebel <3dbernard(at)gmail.com> wrote:
Hello Christopher,

I don't have an answer for you. However, it the cpp sdk allows it, can
you create the property via XSIFactory? This is ideal for creating
"temporary" properties that are garbage collected upon closure. They
don't need to be inspected in modal mode.

In scripting, it would look like:
var oProp = XSIFactory.CreateObject( "My Property name" );
InspectObj( oProp );

Perhaps this could allow you not to put the DeleteObj command in the
property callback and just let XSI do the work.


Cheers
Bernard



On 4/27/07, Christopher Crouzet <christopher.crouzet(at)gmail.com> wrote:
> 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.
>
---
Unsubscribe? Mail Majordomo(at)Softimage.COM with the following text in body:
unsubscribe xsi


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.