#1 2024-12-29 04:29:05

zen010101
Member
Registered: 2024-06-15
Posts: 72

TSynDictionary GPF error

  dict := TSynDictionary.New<RawUTF8, RawUTF8>(true);
  dict.Capacity := 64;
  dict.free;   

These simple code will cause a GPF error at

VarClearProc(Padding[i].Data)

with i = DIC_KEY.

Offline

#2 2024-12-29 11:38:30

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,742
Website

Re: TSynDictionary GPF error

This is a very weird behavior of the VarClearProc() function of the RTL.
Should be fixed by https://github.com/synopse/mORMot2/commit/63b482bf

I have added the corresponding regression tests.
https://github.com/synopse/mORMot2/commit/27cb3d5e

Offline

#3 2024-12-29 13:23:45

zen010101
Member
Registered: 2024-06-15
Posts: 72

Re: TSynDictionary GPF error

It works. :-)

Offline

#4 2024-12-30 07:36:10

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,742
Website

Re: TSynDictionary GPF error

In fact, the VarClearProc() behavior was not weird nor buggy: it was expected.
We should not use varUnknown as variant type, unless we actually store a true IInterface/IUnknown within the variant.

I have made a code review to fix this in our units.

Offline

Board footer

Powered by FluxBB