Page 1 of 1

Bugfix for TsiLangExpert

Posted: Sat Apr 18, 2009 2:42 pm
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.

Posted: Mon Apr 20, 2009 6:12 am
by isiticov
Hi,

Thnak you for your post. We will integrate your suggestion.