Sign in Join

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

Mailing lists / lazarus / 2012-03

SynEdit free my TSynCompletion when freed

5 messages · 2 people ·

Reply by email Subscribe to this list Your subscription

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

Zaher Dirkey

Hi i have global TSynCompletion for muliple synedit, i created it like this

  FCompletion := TSynCompletion.Create(nil);
  FCompletion.Width := 340;
  FCompletion.EndOfTokenChr := '{}()[]./\:!$&*+-=%';
  FCompletion.OnExecute := @OnExecuteCompletion;
  FCompletion.ShortCut := scCtrl + VK_SPACE;
  FCompletion.CaseSensitive := False;
  FCompletion.AddEditor(vSynEdit);

But when free the TSynEdit component it free that global FCompletion, how can resolve it?

Thanks in advance

I am using last reversion of Lazarus, FPC 2.6

Best Regards
Zaher Dirkey
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20120303/59a9424f/attachment.html>

Reply by email

Martin
to Zaher Dirkey
Zaher Dirkey wrote 13 lines
Hi i have global TSynCompletion for muliple synedit, i created it like this FCompletion := TSynCompletion.Create(nil); FCompletion.Width := 340; FCompletion.EndOfTokenChr := '{}()[]./\:!$&*+-=%'; FCompletion.OnExecute := @OnExecuteCompletion; FCompletion.ShortCut := scCtrl + VK_SPACE; FCompletion.CaseSensitive := False; FCompletion.AddEditor(vSynEdit); But when free the TSynEdit component it free that global FCompletion, how can resolve it?

Create the SynCompletion with an owner. Any owner will do.

Reply by email

Martin
to Martin
Martin wrote 17 lines
On 03/03/2012 12:59, Zaher Dirkey wrote: > Hi i have global TSynCompletion for muliple synedit, i created it > like this > > FCompletion := TSynCompletion.Create(nil); > FCompletion.Width := 340; > FCompletion.EndOfTokenChr := '{}()[]./\:!$&*+-=%'; > FCompletion.OnExecute := @OnExecuteCompletion; > FCompletion.ShortCut := scCtrl + VK_SPACE; > FCompletion.CaseSensitive := False; > FCompletion.AddEditor(vSynEdit); > > But when free the TSynEdit component it free that global FCompletion, > how can resolve it? Create the SynCompletion with an owner. Any owner will do.

Actually, if you added ass the synedit, then only the last should destroy it

So if it is freed, while having any added SynEdit ,then you found a bug

Reply by email

Martin
to Martin
Martin wrote 24 lines
On 03/03/2012 13:29, Martin wrote: > On 03/03/2012 12:59, Zaher Dirkey wrote: >> Hi i have global TSynCompletion for muliple synedit, i created it >> like this >> >> FCompletion := TSynCompletion.Create(nil); >> FCompletion.Width := 340; >> FCompletion.EndOfTokenChr := '{}()[]./\:!$&*+-=%'; >> FCompletion.OnExecute := @OnExecuteCompletion; >> FCompletion.ShortCut := scCtrl + VK_SPACE; >> FCompletion.CaseSensitive := False; >> FCompletion.AddEditor(vSynEdit); >> >> But when free the TSynEdit component it free that global >> FCompletion, how can resolve it? > > Create the SynCompletion with an owner. Any owner will do. > Actually, if you added ass the synedit, then only the last should destroy it So if it is freed, while having any added SynEdit ,then you found a bug

Added to changes

http://wiki.lazarus.freepascal.org/Lazarus_0.99.0_release_notes#SynEdit:_TSynCompletion

Reply by email

Zaher Dirkey
to Martin: Actually, if you added ass the synedit, then only the last should destroy it So if it is…
Create the SynCompletion with an owner. Any owner will do.

Thank you Martin.

It is created it in global object i cant have an owner, but i resolved it by inherit it with override this OwnedByEditor function

function TmneSynCompletion.OwnedByEditor: Boolean;
begin
  Result := False;
end;
Actually, if you added as the synedit, then only the last should destroy it

Not sure in fact.

Best Regards

Zaher Dirkey
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20120303/b21a00cf/attachment.html>

Reply by email