← All bug reports

FS#17RLineEntityPointer doesn't work as function argument of type REntity*

Type
Bug
Status
Closed
Resolution
Won't fix
Category
ECMAScript
Severity
Low
Priority
Very Low
Reported version
Development
Target version
Post 3.0
Operating system
All
Reported
2011-04-18 by anonymous
Closed
2013-12-16 by andrew

Script code (SvgExporter.js):

245 // only export entities on main block "*Model_Space":
246 if (realEntity.getBlockId() == this.doc.getBlockId("*Model_Space")) {
247   RFileExporterAdapter.prototype.exportEntity.call(this, entity, false);
248 }

Script debugger exception:

Uncaught exception at /home/martin/workspace/rsframework/scripts/File/SvgExport/SvgExporter.js:246:
Error: :-1:-1: RExporter: Argument 0 is not of type REntity*.
<native>(RLineEntityPointer(0xb6fb158), false) at -1
<anonymous>(entity = RLineEntityPointer(0xb6fb158), preview = false) at
/home/martin/workspace/rsframework/scripts/File/SvgExport/SvgExporter.js:246
<anonymous>() at /home/martin/workspace/rsframework/scripts/File/SvgExport/SvgExporter.js:211

Workaround: Used exportEntity() with ID as argument instead. However there may be other cases where no alternative method is available.

RFileExporterAdapter.prototype.exportEntity.call(this, realEntity.getId());

Comments (1)

andrew 2011-04-18

The proper way to deal with this for now is to use QSharedPointer::data():

// assuming that 'entity' is of type RLineEntityPointer:
RFileExporterAdapter.prototype.exportEntity.call(this, entity.data());

The ECMA wrappers could probably be extended to handle this automatically when needed.