Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2007-01

"Variant array locked" error for now apparent reason

6 messages · 5 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Graeme Geldenhuys

As the subject line says, I keep getting this error and I can't see why! I'm trying to get the last 4 unit test errors fixed running the tiOPF project under FPC 2.1.1. (latest SVN revision)

The tiOPF function tiVariantArrayToString() converts a Variant Array to a String. I placed some writeln() statements in the code to see how far it gets before the error occurs. As you can see from the backtrace output, that it finishes (exits) the function, and then the error occurs. Also nowhere in the code do I lock the variant array, as I am not modifying it, just iterating through it's elements.

Hope someone can shed some light on this issue - I'm stuck! :-(

------ Error Start ------
<ListOfErrors>
<Error>
<Message>TTestTIUtils.tiVariantArrayToString: Variant array locked</Message>
<ExceptionClass>EVariantArrayLockedError</ExceptionClass> <ExceptionMessage>Variant array locked</ExceptionMessage> <SourceUnitName>/mnt/data/programming/3rdParty/tiOPF2/Source/Core/tiUtils.pas</SourceUnitName> <LineNumber>890</LineNumber>
<FailedMethodName>_INTTOSTR</FailedMethodName>
</Error>
</ListOfErrors>

------ Error End --------

------------ The Code   ------------
function  tiVariantArrayToString(AValue: Variant): string;
  //---------
  procedure appendVariantToStringList(pStringList: TStringList;
      pVariant: Variant; var pIndent: integer);
  var
    i: integer;
    iLow: integer;
    iHigh: integer;
  begin
    if VarIsArray(pVariant) then
//    if tiIsVariantOfType(pVariant, varArray) then
    begin
      iLow := varArrayLowBound(pVariant, 1);
      iHigh := varArrayHighBound(pVariant, 1);
      for i := iLow to iHigh do
      begin
        inc(pIndent);
        if i = iLow then
          pStringList.add(tiSpace(pIndent*3) + '[');
        appendVariantToStringList(pStringList, pVariant[i], pIndent);
        if i = iHigh then
          pStringList.add(tiSpace(pIndent*3) + ']');
        dec(pIndent);
      end;
    end
    else
    begin
      pStringList.add(tiSpace(pIndent*3 + 1) + varToStr(pVariant));
    end;
  end;
var
  lStringList : TStringList;
  pIndent : integer;
  dimcount: integer;
begin
  lStringList := TStringList.Create;
  try
    pIndent := -1;
writeln('*** Start  ***');
    appendVariantToStringList(lStringList, AValue, pIndent);
writeln('*** Finish  ***');
    result := lStringList.Text;
  finally
    lStringList.free;
  end;
writeln('*** Exit  ***');
end;

----------- Code End --------------

... and the backtrace ....

----------- Backtrace Start ----------

(gdb) run
Starting program: /UnitTests/GUI/fpcUnitTIOPFGui
[Thread debugging using libthread_db enabled]
[New Thread -1213237024 (LWP 12705)]
InitKeyboardTables - Duplicate Keysymstring="=" for keycode=126 ignored. Existing: vkey=57, flags=0x00 New: vkey=227, flags=0x00 [New Thread -1215480912 (LWP 12711)]
*** Start ***
*** Finish ***
*** Exit ***

[Switching to Thread -1213237024 (LWP 12705)]

Breakpoint 1, 0x08060196 in fpc_raiseexception ()
(gdb) bt
#0 0x08060196 in fpc_raiseexception ()
#1 0x0824c21c in VARIANTS_VARARRAYLOCKEDERROR () at tiUtils.pas:2784 #2 0x0824c4c7 in VARIANTS_RAISEVAREXCEPTION$HRESULT () at tiUtils.pas:2784 #3 0x0824c558 in VARIANTS_VARRESULTCHECK$HRESULT () at tiUtils.pas:2784 #4 0x08247e69 in VARIANTS_SYSVARCLEARPROC$TVARDATA () at tiUtils.pas:2023 #5 0x080605dd in SYSTEM_VARIANT_CLEAR$TVARDATA () #6 0x08062326 in fpc_decref ()
#7 0x0823e1c1 in TIVARIANTARRAYTOSTRING (AVALUE={VARIANT} 0xbfe6562c) at tiUtils.pas:1309
#8 0x082b6bb5 in TTESTTIUTILS__TIVARIANTARRAYTOSTRING (this=0xb78eb240) at tiUtils_TST.pas:1709
#9 0x082007e7 in FPCUNIT_TTESTCASE_$__RUNTEST ()
#10 0x0820071e in FPCUNIT_TTESTCASE_$__RUNBARE ()
#11 0x082017aa in FPCUNIT_PROTECTTEST$TTEST$TTESTRESULT () #12 0x082018a1 in FPCUNIT_TTESTRESULT_$__RUNPROTECTED$TTEST$TPROTECT () #13 0x082017e0 in FPCUNIT_TTESTRESULT_$__RUN$TTESTCASE () #14 0x082006cb in FPCUNIT_TTESTCASE_$__RUN$TTESTRESULT () #15 0x082011c1 in FPCUNIT_TTESTSUITE_$__RUNTEST$TTEST$TTESTRESULT () #16 0x083cf820 in _$FPCUNIT$_Ld39 ()
#17 0x08201176 in FPCUNIT_TTESTSUITE_$__RUN$TTESTRESULT () #18 0x00000070 in ?? ()
#19 0xb7f4f760 in ?? ()
#20 0xb70a1980 in ?? ()
#21 0x00140022 in ?? ()
#22 0xb7a93680 in ?? ()
<...snip...>
----------- Backtrace End ---------------

Graeme Geldenhuys There's no place like S34° 03.168' E018° 49.342'

Reply by email

Florian Klaempfl
to Graeme Geldenhuys
Show quoted text 12 lines
As the subject line says, I keep getting this error and I can't see why! I'm trying to get the last 4 unit test errors fixed running the tiOPF project under FPC 2.1.1. (latest SVN revision) The tiOPF function tiVariantArrayToString() converts a Variant Array to a String. I placed some writeln() statements in the code to see how far it gets before the error occurs. As you can see from the backtrace output, that it finishes (exits) the function, and then the error occurs. Also nowhere in the code do I lock the variant array, as I am not modifying it, just iterating through it's elements. Hope someone can shed some light on this issue - I'm stuck! :-(

I didn't look at it but please submit a bug report, so it won't be forgotten.

Show quoted text 127 lines
------ Error Start ------ <ListOfErrors> <Error> <Message>TTestTIUtils.tiVariantArrayToString: Variant array locked</Message> <ExceptionClass>EVariantArrayLockedError</ExceptionClass> <ExceptionMessage>Variant array locked</ExceptionMessage> <SourceUnitName>/mnt/data/programming/3rdParty/tiOPF2/Source/Core/tiUtils.pas</SourceUnitName> <LineNumber>890</LineNumber> <FailedMethodName>_INTTOSTR</FailedMethodName> </Error> </ListOfErrors> ------ Error End -------- ------------ The Code ------------ function tiVariantArrayToString(AValue: Variant): string; //--------- procedure appendVariantToStringList(pStringList: TStringList; pVariant: Variant; var pIndent: integer); var i: integer; iLow: integer; iHigh: integer; begin if VarIsArray(pVariant) then // if tiIsVariantOfType(pVariant, varArray) then begin iLow := varArrayLowBound(pVariant, 1); iHigh := varArrayHighBound(pVariant, 1); for i := iLow to iHigh do begin inc(pIndent); if i = iLow then pStringList.add(tiSpace(pIndent*3) + '['); appendVariantToStringList(pStringList, pVariant[i], pIndent); if i = iHigh then pStringList.add(tiSpace(pIndent*3) + ']'); dec(pIndent); end; end else begin pStringList.add(tiSpace(pIndent*3 + 1) + varToStr(pVariant)); end; end; var lStringList : TStringList; pIndent : integer; dimcount: integer; begin lStringList := TStringList.Create; try pIndent := -1; writeln('*** Start ***'); appendVariantToStringList(lStringList, AValue, pIndent); writeln('*** Finish ***'); result := lStringList.Text; finally lStringList.free; end; writeln('*** Exit ***'); end; ----------- Code End -------------- ... and the backtrace .... ----------- Backtrace Start ---------- (gdb) run Starting program: /UnitTests/GUI/fpcUnitTIOPFGui [Thread debugging using libthread_db enabled] [New Thread -1213237024 (LWP 12705)] InitKeyboardTables - Duplicate Keysymstring="=" for keycode=126 ignored. Existing: vkey=57, flags=0x00 New: vkey=227, flags=0x00 [New Thread -1215480912 (LWP 12711)] *** Start *** *** Finish *** *** Exit *** [Switching to Thread -1213237024 (LWP 12705)] Breakpoint 1, 0x08060196 in fpc_raiseexception () (gdb) bt #0 0x08060196 in fpc_raiseexception () #1 0x0824c21c in VARIANTS_VARARRAYLOCKEDERROR () at tiUtils.pas:2784 #2 0x0824c4c7 in VARIANTS_RAISEVAREXCEPTION$HRESULT () at tiUtils.pas:2784 #3 0x0824c558 in VARIANTS_VARRESULTCHECK$HRESULT () at tiUtils.pas:2784 #4 0x08247e69 in VARIANTS_SYSVARCLEARPROC$TVARDATA () at tiUtils.pas:2023 #5 0x080605dd in SYSTEM_VARIANT_CLEAR$TVARDATA () #6 0x08062326 in fpc_decref () #7 0x0823e1c1 in TIVARIANTARRAYTOSTRING (AVALUE={VARIANT} 0xbfe6562c) at tiUtils.pas:1309 #8 0x082b6bb5 in TTESTTIUTILS__TIVARIANTARRAYTOSTRING (this=0xb78eb240) at tiUtils_TST.pas:1709 #9 0x082007e7 in FPCUNIT_TTESTCASE_$__RUNTEST () #10 0x0820071e in FPCUNIT_TTESTCASE_$__RUNBARE () #11 0x082017aa in FPCUNIT_PROTECTTEST$TTEST$TTESTRESULT () #12 0x082018a1 in FPCUNIT_TTESTRESULT_$__RUNPROTECTED$TTEST$TPROTECT () #13 0x082017e0 in FPCUNIT_TTESTRESULT_$__RUN$TTESTCASE () #14 0x082006cb in FPCUNIT_TTESTCASE_$__RUN$TTESTRESULT () #15 0x082011c1 in FPCUNIT_TTESTSUITE_$__RUNTEST$TTEST$TTESTRESULT () #16 0x083cf820 in _$FPCUNIT$_Ld39 () #17 0x08201176 in FPCUNIT_TTESTSUITE_$__RUN$TTESTRESULT () #18 0x00000070 in ?? () #19 0xb7f4f760 in ?? () #20 0xb70a1980 in ?? () #21 0x00140022 in ?? () #22 0xb7a93680 in ?? () <...snip...> ----------- Backtrace End ---------------

Reply by email

Graeme Geldenhuys
to Florian Klaempfl

Thanks, will submit a bug report today.

Graeme.

Florian Klaempfl wrote 148 lines
Graeme Geldenhuys schrieb: > As the subject line says, I keep getting this error and I can't see why! > I'm trying to get the last 4 unit test errors fixed running the tiOPF > project under FPC 2.1.1. (latest SVN revision) > > The tiOPF function tiVariantArrayToString() converts a Variant Array > to a String. I placed some writeln() statements in the code to see how > far it gets before the error occurs. As you can see from the backtrace > output, that it finishes (exits) the function, and then the error > occurs. Also nowhere in the code do I lock the variant array, as I am > not modifying it, just iterating through it's elements. > > Hope someone can shed some light on this issue - I'm stuck! :-( I didn't look at it but please submit a bug report, so it won't be forgotten. > > > > ------ Error Start ------ > <ListOfErrors> > <Error> > <Message>TTestTIUtils.tiVariantArrayToString: Variant array > locked</Message> > <ExceptionClass>EVariantArrayLockedError</ExceptionClass> > <ExceptionMessage>Variant array locked</ExceptionMessage> > > <SourceUnitName>/mnt/data/programming/3rdParty/tiOPF2/Source/Core/tiUtils.pas</SourceUnitName> > > <LineNumber>890</LineNumber> > <FailedMethodName>_INTTOSTR</FailedMethodName> > </Error> > </ListOfErrors> > > ------ Error End -------- > > > > ------------ The Code ------------ > function tiVariantArrayToString(AValue: Variant): string; > //--------- > procedure appendVariantToStringList(pStringList: TStringList; > pVariant: Variant; var pIndent: integer); > var > i: integer; > iLow: integer; > iHigh: integer; > begin > if VarIsArray(pVariant) then > // if tiIsVariantOfType(pVariant, varArray) then > begin > iLow := varArrayLowBound(pVariant, 1); > iHigh := varArrayHighBound(pVariant, 1); > for i := iLow to iHigh do > begin > inc(pIndent); > > if i = iLow then > pStringList.add(tiSpace(pIndent*3) + '['); > > appendVariantToStringList(pStringList, pVariant[i], pIndent); > > if i = iHigh then > pStringList.add(tiSpace(pIndent*3) + ']'); > > dec(pIndent); > end; > end > else > begin > pStringList.add(tiSpace(pIndent*3 + 1) + varToStr(pVariant)); > end; > end; > > var > lStringList : TStringList; > pIndent : integer; > dimcount: integer; > begin > lStringList := TStringList.Create; > try > pIndent := -1; > writeln('*** Start ***'); > appendVariantToStringList(lStringList, AValue, pIndent); > writeln('*** Finish ***'); > result := lStringList.Text; > finally > lStringList.free; > end; > writeln('*** Exit ***'); > end; > > ----------- Code End -------------- > > ... and the backtrace .... > > > ----------- Backtrace Start ---------- > > (gdb) run > Starting program: /UnitTests/GUI/fpcUnitTIOPFGui > [Thread debugging using libthread_db enabled] > [New Thread -1213237024 (LWP 12705)] > InitKeyboardTables - Duplicate Keysymstring="=" for keycode=126 ignored. > Existing: vkey=57, flags=0x00 New: vkey=227, flags=0x00 > [New Thread -1215480912 (LWP 12711)] > *** Start *** > *** Finish *** > *** Exit *** > > [Switching to Thread -1213237024 (LWP 12705)] > > Breakpoint 1, 0x08060196 in fpc_raiseexception () > (gdb) bt > #0 0x08060196 in fpc_raiseexception () > #1 0x0824c21c in VARIANTS_VARARRAYLOCKEDERROR () at tiUtils.pas:2784 > #2 0x0824c4c7 in VARIANTS_RAISEVAREXCEPTION$HRESULT () at tiUtils.pas:2784 > #3 0x0824c558 in VARIANTS_VARRESULTCHECK$HRESULT () at tiUtils.pas:2784 > #4 0x08247e69 in VARIANTS_SYSVARCLEARPROC$TVARDATA () at tiUtils.pas:2023 > #5 0x080605dd in SYSTEM_VARIANT_CLEAR$TVARDATA () > #6 0x08062326 in fpc_decref () > #7 0x0823e1c1 in TIVARIANTARRAYTOSTRING (AVALUE={VARIANT} 0xbfe6562c) > at tiUtils.pas:1309 > #8 0x082b6bb5 in TTESTTIUTILS__TIVARIANTARRAYTOSTRING (this=0xb78eb240) > at tiUtils_TST.pas:1709 > #9 0x082007e7 in FPCUNIT_TTESTCASE_$__RUNTEST () > #10 0x0820071e in FPCUNIT_TTESTCASE_$__RUNBARE () > #11 0x082017aa in FPCUNIT_PROTECTTEST$TTEST$TTESTRESULT () > #12 0x082018a1 in FPCUNIT_TTESTRESULT_$__RUNPROTECTED$TTEST$TPROTECT () > #13 0x082017e0 in FPCUNIT_TTESTRESULT_$__RUN$TTESTCASE () > #14 0x082006cb in FPCUNIT_TTESTCASE_$__RUN$TTESTRESULT () > #15 0x082011c1 in FPCUNIT_TTESTSUITE_$__RUNTEST$TTEST$TTESTRESULT () > #16 0x083cf820 in _$FPCUNIT$_Ld39 () > #17 0x08201176 in FPCUNIT_TTESTSUITE_$__RUN$TTESTRESULT () > #18 0x00000070 in ?? () > #19 0xb7f4f760 in ?? () > #20 0xb70a1980 in ?? () > #21 0x00140022 in ?? () > #22 0xb7a93680 in ?? () > <...snip...> > ----------- Backtrace End --------------- > > _______________________________________________ fpc-pascal maillist - http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Graeme Geldenhuys There's no place like S34° 03.168' E018° 49.342'

Reply by email

Leonardo M. Ram�
to Rodrigo Palhano: How can FPC help me to develop web applications ? What kind of web technologies are…
How can FPC help me to develop web applications ? What kind of web technologies are already available in FPC ?

Take a look at PSP:

http://www.psp.furtopia.org/cgi-bin/psp/index.psp

Leonardo M. Ramé
http://leonardorame.blogspot.com

__________________________________________________ Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com

Reply by email