Editor Crash Found


photo

Recommended Posts

Posted (edited)

Hello there,

To add property callback I have changed the ComponentSystem.h as follows.

ComponentVariable class and added two getter.

class ComponentVariable
{
public:
	ComponentVariable() = default;
	ComponentVariable(PropertyWrapper *component, const char *name, int type,
		const char *title, const char *tooltip, const char *group);
	virtual ~ComponentVariable();

	UNIGINE_INLINE int getID() const { return parameter->getID(); }
	UNIGINE_INLINE const char* getName() const { return name.get(); }
	UNIGINE_INLINE int getType() const { return type; }
	const char *getTypeName() const;
	UNIGINE_INLINE virtual Unigine::String getValueAsString() { return Unigine::String::null; }
	UNIGINE_INLINE virtual int nullCheck() { return 0; }

	/*********** [2020-07-06][Rohit Gonsalves][Added this getter to access property and PropertyParameter in Componment] **************/

	UNIGINE_INLINE PropertyWrapper* getPropertyWrapper() const { return holder; }
	UNIGINE_INLINE PropertyParameterPtr getPropertyParameter() const { return parameter; }

	/*********** [2020-07-06][Rohit Gonsalves][Added this getter to access property and PropertyParameter in Componment] **************/

	virtual void save(const Unigine::XmlPtr &parameter);

	virtual void setParameter(const Unigine::PropertyParameterPtr &param);

protected:
	int is_type_name(const char *name) const;

	PropertyWrapper *holder;

	Unigine::PropertyParameterPtr parameter;
	Unigine::String name;
	Unigine::String title;
	Unigine::String tooltip;
	Unigine::String group;
	int type;
};

In my component header I have,

PROP_PARAM(Switch, color_precision, 0, "YUV8,YUV10,RGBA8,RGB10", "Color Precision", "Digital Bit depth of colors", "General");

Now, In my Component Init,

void CAroBMDDecklinkOutput::init()
{	
	PropertyPtr property = color_precision.getPropertyWrapper()->property;
	property->addCallback(Property::CALLBACK_PARAMETER_CHANGED, MakeCallback(this, &CAroBMDDecklinkOutput::parameter_changed));		
}

void CAroBMDDecklinkOutput::parameter_changed(PropertyPtr _objProperty, int _iNum)
{
	Log::message("Parameter \"%s\" of the property \"%s\" has changed its value.\n", _objProperty->getParameterPtr(_iNum)->getName(), _objProperty->getName());
}

Works as Expected.

If I change the property, I get the callback and I am happy to receive it. But when I click on Reset button, There is a crash. 

image.png.77e281cfd2f528ca12d6c4114c127b83.png

Probably on Reset, only run is called with single argument than the two. Property and num.

Regards,

Rohit

Edited by rohit.gonsalves
Link to post

Did you able to reproduce it?

Please suggest.

Regards,

Rohit

Link to post

Hi Rohit,

But when I click on Reset button
What is the "Reset" button?

Best regards,
Alexander

Link to post
PropertyPtr property = color_precision.getPropertyWrapper()->property;

You don't need to do this. Component already has the "property" variable:

void CAroBMDDecklinkOutput::init()
{	
	property->addCallback(Property::CALLBACK_PARAMETER_CHANGED, MakeCallback(this, &CAroBMDDecklinkOutput::parameter_changed));		
}

 

  • Like 1
Link to post
Posted (edited)

Thanks Alexander for getting rid of that change I put. I can directly access it. I got confused with many classes in-between. Thanks for this.

But the crash is still there. Here is the parameter reset button. Otherwise what you call it?

image.png.089c7eaede7d1263d2a7c0e2227c5854.png

 

Regards,

Rohit

Edited by rohit.gonsalves
Put smaller Image to understand it better.
Link to post

@alexander,

Do you able to reproduce this at your end?

Regards,

Rohit

Link to post

Dear Morbid,

No worries. Patience is all here. All the best for new release.

Just pointed out this, probably you would consider for hot fix later.

Regards,

Rohit

Link to post
  • 3 weeks later...

Hi!

Can you send source example and describe how you connect your logic to editor?

Link to post

@moroz,

This particular question is becoming so interesting to me. 

I know why did you ask for example? I thought, my implementation is normal but after your question, I try to do it the simpler way and it is not possible to have it without Plugin. So thankful for this question of yours.

Please find the Comp_Prop project attached. I have written another project in the source, compdemo. Steps to follow.

  1. Please recreate the engine files after downloading the project. (Add the project and reconfigure it. I think just say Update Configuration without changing anything.
  2. Open it in editor once. Close it.
  3. Open the comp_prop.sln.
  4. Setup compdemo as the startup project and run the application. 
  5. You will have one property created by component. color_producer.prop
  6. Assign this property to any node.
  7. Change the property of texture dimension and color.
  8. Check the console window.
  9. As soon as you hit reset button. It will crash (in Debug.)

By the way, Moroz, When I prepared this sample for you. I have created debug as well as release configurations. Surprisingly, in Debug, the editor crashes with a respective error. and in the release, everything works just fine. This is today's invention. :-)

I hope this sample will help to check and understand everything.

Regards,

Rohit

Comp_Prop.zip

Link to post

I have checked this crash. It occures because of bug in PropertyParameter::resetValue(), we will fix it.

  • Like 1
Link to post

Dear @moroz,

Thanks for the update.

Rohit

Link to post