[Gambas-user] emulated empty settings collection get a crash when write it
PICCORO McKAY Lenz
mckaygerhard at gmail.com
Wed Jul 4 22:51:25 CEST 2018
well in gambas 3.11 got a crash in gambas << 3.10 got only warning
code:
Export
Inherits Collection
Property Read {Null} As Variant '' emulacion de null para que una
lib collecion lo admita
Private $vNull As Variant '' variable null emulada para que
sea aceptada en una colleccion
Public Sub _init()
$vNull = VarPtr($vNull)
cf = New Excfg
End
Private Function Null_Read() As Variant
Return $vNull
End
' sobreescritura de get, put y next par admitir null
Public Sub _get(Key As String) As Variant
Dim vVal As Variant
vVal = Super[Key]
If TypeOf(vVal) = gb.Pointer And If vVal = me.Null Then vVal = Null
Return vVal
End
Public Sub _put(Value As Variant, Key As String)
If IsNull(Value) Then Value = me.Null
Super[Key] = Value
End
Public Sub _next() As Variant
Super._next()
If Not Enum.Stopped Then Return _get(Me.Key)
End
Lenz McKAY Gerardo (PICCORO)
http://qgqlochekone.blogspot.com
2018-07-04 16:28 GMT-04:00 Jussi Lahtinen <jussi.lahtinen at gmail.com>:
> Please show the code, which gives that error (it's error, not crash?).
>
>
> Jussi
>
> On Wed, Jul 4, 2018 at 10:13 PM, PICCORO McKAY Lenz <mckaygerhard at gmail.com>
> wrote:
>>
>> In the past I was told to emulate the "null" and I did it based on the
>> json class, but now I have the following problem
>>
>> I have my own Settings class but when I try to write, I get an error
>> and a crash because some keys instead of getting the string I get a
>> reference (as emulated in the json class)
>>
>> Of course the settings clas at write does not xpect to have any null
>> key value, so that's the problem
>>
>> how can overrite the process to do not get a crash?
>> or how to write those null keys into a empty string?
>>
>> i got at console that poutput:
>>
>> gb.settings: warning: unable to save settings:
>> /home/general/Devel/gambasex/excore/exdatabase.conf: Settings.Save.204
>> Unable to save settings: Settings.WriteValue.563 Type mismatch: wanted
>> Object, got Pointer instead
>>
>> that due emulated null value based on json class of gambas
>>
>> Lenz McKAY Gerardo (PICCORO)
>> http://qgqlochekone.blogspot.com
>>
>> ----[ Gambas mailing-list is hosted by https://www.hostsharing.net ]----
>
>
>
>
> ----[ Gambas mailing-list is hosted by https://www.hostsharing.net ]----
>
More information about the User
mailing list