avose / GLShell

OpenGL Terminal
GNU Lesser General Public License v2.1
2 stars 0 forks source link

wx.CallLater() -> AddPendingEvent() #41

Closed avose closed 11 months ago

avose commented 12 months ago

There are issues with wx.CallLater(), where a call will be queued up, and then the object who's member function is going to be called later is destroyed, and then the call happens... in a member function of a destroyed wx widget. -- I currently work around this in a round about way with done flags, and retries, and.. it's messier than it needs to be.

If I just make a new event type, and use AddPendingEvent(), I can destroy the wx widget any time I want, because once it's destroyed, it won't be getting events anymore. Makes things a lot cleaner.

avose commented 11 months ago

I did clean up the graph canvas's rendering loop a bit.

However, in general, things aren't as straightforward to replace as I was expecting. There are still issues with calling wx.Refresh() from a paint callback combined with a wx.YieldIfNeeded(). What I have now really isn't too terrible considering the limitations.

I was thinking of using the new approach in the search result list, but even there, what I have now has advantages (it generates fewer events per search result than the other method would without jumping through hoops).

I'm going to go ahead and close this one without doing much more right now, as I did a little cleanup, and I don't really see any other path forward, and what I have now has some advantages..