[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Octave-bug-tracker] [bug #54319] saving a classdef to a MAT file then l
From: |
Sébastien Villemot |
Subject: |
[Octave-bug-tracker] [bug #54319] saving a classdef to a MAT file then loading it crashes Octave |
Date: |
Mon, 16 Jul 2018 12:53:45 -0400 (EDT) |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Firefox/52.0 |
URL:
<http://savannah.gnu.org/bugs/?54319>
Summary: saving a classdef to a MAT file then loading it
crashes Octave
Project: GNU Octave
Submitted by: svillemot
Submitted on: Mon 16 Jul 2018 04:53:43 PM UTC
Category: Interpreter
Severity: 3 - Normal
Priority: 5 - Normal
Item Group: None
Status: None
Assigned to: None
Originator Name:
Originator Email:
Open/Closed: Open
Discussion Lock: Any
Release: 4.4.0
Operating System: GNU/Linux
_______________________________________________________
Details:
Hi,
Assume you have defined the following trivial classdef:
classdef NumValue
properties
Number = 1
end
end
Then the following sequence crashes Octave:
octave:1> a = NumValue()
a =
<object NumValue>
octave:2> save -mat foo.mat a
warning: struct: converting a classdef object into a struct overrides the
access restrictions defined for properties. All properties are returned,
including private and protected ones.
warning: struct: converting a classdef object into a struct overrides the
access restrictions defined for properties. All properties are returned,
including private and protected ones.
octave:3> load foo.mat
octave-gui: libinterp/octave-value/ov-class.cc:1070: bool
octave_class::reconstruct_exemplar(): Assertion `have_ctor' failed.
fatal: caught signal Aborted -- stopping myself...
Aborted
The problem is that Octave tries to reload the object as if it was a legacy
class, instead of a classdef.
I attach a draft patch that prevents the crash and make Octave return a
struct.
Ideally Octave should rather return a classdef value (see also bug #45833). I
would be willing to write such a patch, but I would ideally need some guidance
(concerning the complexity of the task and the pitfalls to avoid).
Best,
_______________________________________________________
File Attachments:
-------------------------------------------------------
Date: Mon 16 Jul 2018 04:53:43 PM UTC Name: classdef-mat-load.patch Size:
726B By: svillemot
<http://savannah.gnu.org/bugs/download.php?file_id=44564>
_______________________________________________________
Reply to this item at:
<http://savannah.gnu.org/bugs/?54319>
_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/
- [Octave-bug-tracker] [bug #54319] saving a classdef to a MAT file then loading it crashes Octave,
Sébastien Villemot <=