Author Topic: PJSR: new Matrix(Matrix A) crash?  (Read 4238 times)

Offline mschuster

  • PTeam Member
  • PixInsight Jedi
  • *****
  • Posts: 1087
PJSR: new Matrix(Matrix A) crash?
« on: 2015 January 02 11:37:57 »
Hi Juan,

I assumed this constructor gives copy, but I see a crash on Win 7 1123.

Mike

Code: [Select]
var m1 = new Matrix([1, 0, 0, 2], 2, 2);
var m2 = new Matrix(m1);

Code: [Select]
*** Error [000]: <...>/test.js, line 3: Error: At address 000000014011CBDA with exception code C0000005 :
Access violation: invalid memory read operation at address FFFFFFFFFFFFFFFF

Offline Juan Conejero

  • PTeam Member
  • PixInsight Jedi Grand Master
  • ********
  • Posts: 7111
    • http://pixinsight.com/
Re: PJSR: new Matrix(Matrix A) crash?
« Reply #1 on: 2015 January 02 13:42:03 »
Bug confirmed. The constructor:

new Matrix( Matrix A[, int startRow, int startCol, int rows, int cols] )

and the method:

void Matrix.assign( Matrix A[, int startRow, int startCol, int rows, int cols] )

are broken. This is a regression in the latest versions of PixInsight 1.8. I'll fix this in the next version. In the meanwhile, you can use the following workaround:

Matrix.prototype.clone = function()
{
   return (new Matrix( 0, this.rows, this.columns )).add( this );
};


Example:

var m1 = new Matrix([1, 0, 0, 2], 2, 2);
var m2 = m1.clone();


Sorry for the trouble.
Juan Conejero
PixInsight Development Team
http://pixinsight.com/