[Gambas-user] Segmentation Fault - Deserialization
Brian G
brian at westwoodsvcs.com
Thu Jul 16 22:05:22 CEST 2020
Just went back again and tested with as object and as variant and both work correctly
is everyone using the latest 3.15 build
Thank You
Brian G
----- Original Message -----
From: "T Lee Davidson" <t.lee.davidson at gmail.com>
To: "Gambas mailing list" <user at lists.gambas-basic.org>
Sent: Thursday, July 16, 2020 12:57:48 PM
Subject: Re: [Gambas-user] Segmentation Fault - Deserialization
On 7/16/20 3:10 PM, Brian G wrote:
> Ok I looked at you project,
>
> My understanding is that when you use as object or as variant, the serialization includes the name of the class in the stream,
> so that when its recreated Gambas can instantiate the object from the stream because it can read the class name before invoking
> the _read or _write special methods on that class..
>
> I guess it should know the name from the - as class name -, But I have never used with a specific class name.
>
> I have been using this for about a year now, and have always used it that way with as object or variant.
>
> Is there a reason, you need to use the specific class name when you read and write?
>
> Thank You
> Brian G
>
Your understanding appears to be correct.
Using the example given at http://gambaswiki.org/wiki/lang/special/read :
- Write #f1, Item1 As Object 'Writes the class name to the output file,
- Write #f1, Item1 As MyClass 'Does not write the class name to the output file and causes a SegFault upon read.
However, in Matthew's project, changing line 19 to be "Write #hFile, hObj As Object" does not correct the issue since, for some
reason, the class name is NOT written to the output file.
The question is, why?
I thought perhaps there was a collision between the Class1 {Name} property and the object's .Name property. But, changing the
symbol name of the user-defined {Name} property did not solve the SegFault.
--
Lee
----[ http://gambaswiki.org/wiki/doc/netiquette ]----
More information about the User
mailing list