Navigation Menu

Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A run-time error occurring when text_changed & focus events are interleaved #332

Closed
jk-jeon opened this issue Aug 25, 2018 · 2 comments
Closed

Comments

@jk-jeon
Copy link

jk-jeon commented Aug 25, 2018

Please see the following code:

#include <nana/gui/wvl.hpp>
#include <nana/gui/widgets/form.hpp>
#include <nana/gui/widgets/textbox.hpp>

int main() {
  nana::form fm{ nana::API::make_center(200, 200) };
  nana::textbox in{ fm, nana::rectangle{ 0, 0, 200, 200 } };

  in.events().text_changed([&]() {
    if( in.caption() != "" )
      in.fgcolor(nana::colors::red);
  });
  in.events().focus([&]() {
    in.caption("");
  });

  fm.show();
  nana::exec();
}

Executing this code, clicking the textbox, and then pressing the return key throws an error.
(text_editor.cpp, line 585; this->sections's size is 1, but the code is accessing the second element.)
I couldn't analyze what's happening here.
Thanks.

@cnjinhao
Copy link
Owner

Thank you for reporting this issue. To fix the error, it needs some refactoring.

@cnjinhao
Copy link
Owner

Fixed, a patch has been checked into the hotfix branch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants