Code Monkey home page Code Monkey logo

Comments (16)

c-smile avatar c-smile commented on May 13, 2024

I cannot reproduce this on samples of native behaviors from the SDK.

For each particular element/behavior HANDLE_INITIALIZATION shall happen on element construction/destruction.

It appears as your code reloads document in a loop or something like that.

from sciter-sdk.

Mikanoshi avatar Mikanoshi commented on May 13, 2024

Why 6143 and every single version before was working then? I only changed DLL. Some latest changes caused that, don't even know where to look... Without SciterAttachEventHandler() program does not have any signs of activity, so I doubt it's doing anything. Also that endless loop is without any delays, so program's UI thread just uses all resources of 1 CPU core and freezes completely.

from sciter-sdk.

pravic avatar pravic commented on May 13, 2024

@Mikanoshi Just out of curiosity: can you try 6143 again?

from sciter-sdk.

Mikanoshi avatar Mikanoshi commented on May 13, 2024

Yes, 6143 works. This seems to be the problem:
https://github.com/Mikanoshi/SciDe/blob/master/source/Sciter.pas#L3992

If event param has a target that is not null new element object is being created and new listener is attached, hence the loop.

from sciter-sdk.

c-smile avatar c-smile commented on May 13, 2024

I have some doubts about this:

function ElementFactory(const ASciter: TSciter; const he: HELEMENT): TElement;
begin
  Result := TElement.Create(ASciter, he);
end;

What if he (DOM element) already has TElement instance created for it?
Why it creates new instance each time when it gets called for the same element?

I think it shall check first if that element is already in this map:

  FSciter.ManagedElements.Add(Self);

No?

Otherwise this will create new TElement on each MOUSE_MOVE event for example. No?

from sciter-sdk.

pravic avatar pravic commented on May 13, 2024

For me, the question is why would you want to attach a new event handler to the params.heTarget instead of just wrapping it in TElement? Or, even, doing that lazily during TElementOnControlEventArgs.Target reading?

What was the idea behind of the SciterAttachEventHandler in TElement?

from sciter-sdk.

c-smile avatar c-smile commented on May 13, 2024

What was the idea behind of the SciterAttachEventHandler in TElement?

I suspect that they want to catch element destruction notification from engine's side. But why they would need that is unknown. As soon as TElement holds reference of DOM element it is alive, it could be not connected to the DOM but is valid.

from sciter-sdk.

Mikanoshi avatar Mikanoshi commented on May 13, 2024

Because it causes Access Violation? No idea, I didn't write the wrapper :)
You get element and event handler attached to it supposed to make all the event listeners work, e.g.:

var
  el: IElement;
begin
  el := Sciter.Select('#test');
  TElement(el).OnMouse = TreatMouseEvents;
end;

But var has to be used elsewhere, because it's an interface and manages references automatically, variable is destroyed if no longer used. I tried to add elements to ManagedElements and then check them, but it doesn't work for 2 reasons - above one is the first, FTarget is destroyed after HandleMouse() finishes, second one is that Sciter keeps sending mouse events for < html > element even after listener is detached.
I added logging to element creation/destruction and on old version creating and destroying TElement for root (< html >) does not cause additional events when moving mouse over Sciter window.

from sciter-sdk.

c-smile avatar c-smile commented on May 13, 2024

TElement(el).OnMouse = TreatMouseEvents;

It needs event handler creation only on OnMouse property assignment.

from sciter-sdk.

Mikanoshi avatar Mikanoshi commented on May 13, 2024

Does it matter? If there is no assignment the TElement is destroyed and event handler is detached. But I think that Sciter does not do that for root html, so elements for the target param are being created and destroyed, but listeners pile up.

from sciter-sdk.

c-smile avatar c-smile commented on May 13, 2024

that Sciter does not do that for root html

Does not do what exactly?

from sciter-sdk.

c-smile avatar c-smile commented on May 13, 2024

but listeners pile up.

Yes, that architecture of Delphi wrapper is tend to pile up memory. Yet to slow down event handling on each event received.

from sciter-sdk.

Mikanoshi avatar Mikanoshi commented on May 13, 2024

Listeners pile up in Sciter, not Delphi :)

Does not do what exactly?

Remove listener after SciterDetachEventHandler() call.
I only have 1 place where SciterAttachEventHandler() is called, and for each call there is a SciterDetachEventHandler() call with the same arguments, but 6172 keeps sending events to the event proc (_SciterElementEventProc).

from sciter-sdk.

c-smile avatar c-smile commented on May 13, 2024

There is a problem with SciterDetachEventHandler() at the moment. Looking.

from sciter-sdk.

c-smile avatar c-smile commented on May 13, 2024

I've updated Windows binaries here, on GitHub. Check them please.

from sciter-sdk.

Mikanoshi avatar Mikanoshi commented on May 13, 2024

Fixed πŸ‘

from sciter-sdk.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.