Author Topic: Endless stream of events - CB-16.01  (Read 7540 times)

Offline ridge

  • Multiple posting newcomer
  • *
  • Posts: 17
Endless stream of events - CB-16.01
« on: January 25, 2017, 12:57:24 am »
I inserted DebugLog statements in main.cpp right before event.Skip() in each handler (e.g., OnEditMenuUpdateUI, OnViewMenuUpdateUI, OnSearchMenuUpdateUI).  Then, built and ran CB.  There appears to be an unexpected endless stream of events even when there is no UI activity.

OnEditMenuUpdateUI called
OnEditMenuUpdateUI called
OnEditMenuUpdateUI called
.
.
.
Is this expected?

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13406
    • Travis build status
Re: Endless stream of events - CB-16.01
« Reply #1 on: January 25, 2017, 01:15:23 am »
Don't know. Have you tried to place a breakpoint to see what triggers the events?
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 6079
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: Endless stream of events - CB-16.01
« Reply #2 on: January 25, 2017, 02:47:03 pm »
This is by design, because we update the menu item status in a single function, this function is called about 500ms(maybe another value, but I can't remember for now) at a time.
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

Offline yvesdm3000

  • Almost regular
  • **
  • Posts: 225
Re: Endless stream of events - CB-16.01
« Reply #3 on: January 25, 2017, 03:18:30 pm »
This is by design, because we update the menu item status in a single function, this function is called about 500ms(maybe another value, but I can't remember for now) at a time.
Shouldn't this happen when the menu is clicked e.g. opened ?

Yves
Clang based code completion for Code::Blocks:   http://github.com/yvesdm3000/ClangLib

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 6079
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: Endless stream of events - CB-16.01
« Reply #4 on: January 25, 2017, 04:10:10 pm »
This is by design, because we update the menu item status in a single function, this function is called about 500ms(maybe another value, but I can't remember for now) at a time.
Shouldn't this happen when the menu is clicked e.g. opened ?

Yves
It should. But as far as I know, there are too many menu items and to many menu status, so we have some alternative way to update the menu status, see discussions here: wxUpdateUIEvent performance issues

EDIT: I just see in the source code, we have 100ms setting values.
Code
MainFrame* CodeBlocksApp::InitFrame()
{
    static_assert(wxMinimumVersion<2,8,12>::eval, "wxWidgets 2.8.12 is required");

    MainFrame *frame = new MainFrame();
    wxUpdateUIEvent::SetUpdateInterval(100);
    SetTopWindow(nullptr);

    if (g_DDEServer && m_DDE)
        g_DDEServer->SetFrame(frame); // Set m_Frame in DDE-Server

    return frame;
}
« Last Edit: January 25, 2017, 04:12:36 pm by ollydbg »
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

Offline ridge

  • Multiple posting newcomer
  • *
  • Posts: 17
Re: Endless stream of events - CB-16.01
« Reply #5 on: January 25, 2017, 08:11:02 pm »
This is important information - thanks for the link.
It hasn't been discussed since 2009??
I think Jens' comments are worth noting - perhaps we should take heed in the release version?

1. Bind only one ID to the appropriate OnxxxMenuUpdateUI-function.
2. Set the update-interval to 500 ms (or 200 ms?).

What do you think?
I'd like to understand why we're binding all of the events - there must be a good reason - anybody know?
« Last Edit: January 25, 2017, 08:28:59 pm by ridge »

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13406
    • Travis build status
Re: Endless stream of events - CB-16.01
« Reply #6 on: January 25, 2017, 08:17:41 pm »
Lets start with: What is the real problem?
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline ridge

  • Multiple posting newcomer
  • *
  • Posts: 17
Re: Endless stream of events - CB-16.01
« Reply #7 on: January 25, 2017, 08:34:54 pm »
Good question.  My original post was a request for information (which I got).
I'm trying to figure out why wxChoice items don't show up on custom toolbars in CodeBlocks
(at least on MacOS).  As I began debugging, it was unexpected to receive so many events
(which seemed unnecessary) so I thought I'd ask.

I suppose the problem is that I don't have a design document for CodeBlocks.
« Last Edit: January 25, 2017, 08:49:08 pm by ridge »

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13406
    • Travis build status
Re: Endless stream of events - CB-16.01
« Reply #8 on: January 25, 2017, 09:31:53 pm »
There is no such thing as design document. Use the code svn blame/git blame are your best friends.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]