Board index » delphi » Access violation error in vcl50.dpl, var TStringList

Access violation error in vcl50.dpl, var TStringList

Since upgrading to Delphi 5 from 4.03, I am getting access violation errors
when passing TStringList's as Var parameters within a package, when invoked
from outside of the package by another application built using all packages
via another package (asking for trouble?). All worked fine before upgrade.
I'm desperate, any ideas please?

type
    TErrorExample = class(TObject)
    private
        MyStringList1: TStringList;
        MyStringList2: TStringList;
        procedure DoThisThing(var ThisStringList: TStringList);
    public
        procedure DoSomething(WhatToDo: integer);
        constructor Create etc. creates the 2 TStringLists ok
        destructor Destroy etc. destroys the 2 TStringLists ok
    end;

    procedure TErrorExample.DoThisThing(var ThisStringList: TStringList);
    begin
        ThisStringList.Add('hello'); // kaboom ! error in Vcl50.dpl
    end;

    procedure TErrorExample.DoSomething(WhatToDo: integer);
    begin
        if WhatToDo = 1 then
            DoThisThing(MyStringList1)
        else
            DoThisThing(MyStringList2);
    end;

--
Steve
http://www.geocities.com/SiliconValley/Sector/6376

 

Re:Access violation error in vcl50.dpl, var TStringList


Hi Steve,

You will have to make sure ALL of your packages are recompiled under D5 for
your application to work.  In the future, you will get a quicker response by
posting this problem to delphi.objectpascal.  Good Luck!

--

R/S Aaron Rhodes
Delphi Technical Support

Quote
> Since upgrading to Delphi 5 from 4.03, I am getting access violation
errors
> when passing TStringList's as Var parameters within a package, when
invoked
> from outside of the package by another application built using all
packages
> via another package (asking for trouble?). All worked fine before upgrade.
> I'm desperate, any ideas please?

> type
>     TErrorExample = class(TObject)
>     private
>         MyStringList1: TStringList;
>         MyStringList2: TStringList;
>         procedure DoThisThing(var ThisStringList: TStringList);
>     public
>         procedure DoSomething(WhatToDo: integer);
>         constructor Create etc. creates the 2 TStringLists ok
>         destructor Destroy etc. destroys the 2 TStringLists ok
>     end;

>     procedure TErrorExample.DoThisThing(var ThisStringList: TStringList);
>     begin
>         ThisStringList.Add('hello'); // kaboom ! error in Vcl50.dpl
>     end;

>     procedure TErrorExample.DoSomething(WhatToDo: integer);
>     begin
>         if WhatToDo = 1 then
>             DoThisThing(MyStringList1)
>         else
>             DoThisThing(MyStringList2);
>     end;

> --
> Steve
> http://www.geocities.com/SiliconValley/Sector/6376

Other Threads