Bugfix for TsiLangExpert

All announcements, questions and issues related to the TsiLang Components Suite.
Post Reply
BenjyKid
Posts: 18
Joined: Wed Apr 05, 2006 4:08 pm

Bugfix for TsiLangExpert

Post by BenjyKid »

Hi,

could you please fix the following bug in TsiLangExpert because it makes the IDE unstable (even if you hide the exception!).

Code: Select all

  TsiLangExpert = class(TInterfacedObject, IOTAWizard)
  [...]
    {$IFNDEF DELPHI8}
    AddInNotifier: IOTAIDENotifier;//was TsiAddInNotifier;
    {$ENDIF}

Code: Select all

destructor TsiLangExpert.Destroy;
[...]
    try
//      if AddInNotifier <> nil then  //@@@ SZ not needed because setting AddInNotifier to nil will free this
//        AddInNotifier.Free;
    except
    end;
Your code is mixing interfaces and objects. When want to destroy the object, you have a problem because the interface will be freed when the refcount is set to 0. But it is not really possible for you to tell if that happened or not. So you don't know if you need to free the interface. You will either free your object another time, or you might even free something else. :shock:

The solution is very easy. Just change the type of the AddInNotifier to IOTAIDENotifier. Then you're only using the interface version. The interface will be freed when you set it to nil.
isiticov
Site Admin
Posts: 2383
Joined: Thu Nov 21, 2002 3:17 pm

Post by isiticov »

Hi,

Thnak you for your post. We will integrate your suggestion.
Best regards,
Igor Siticov.
Post Reply