FLTK logo

Re: [fltk.general] Strange artefacts visible on controls

FLTK matrix user chat room
(using Element browser app)   FLTK gitter user chat room   GitHub FLTK Project   FLTK News RSS Feed  
  FLTK Apps      FLTK Library      Forums      Links     Login 
 All Forums  |  Back to fltk.general  ]
 
Previous Message ]New Message | Reply ]Next Message ]

Re: Strange artefacts visible on controls imm Jul 08, 2022  
 
On Fri, 8 Jul 2022 at 11:52, Jck_01 wrote:
>
>   It's strange but I found another line which created the artifacts, and this line used the FLTK GUI. Namely, at the end of the callback for the startButton I used the following line:
> startButton->deactivate();
>

Oh dear, that is odd.
Simply deactivating a button from within the callback should not have
any "odd" side effects.
And you are sure the fltk context is only being manipulated from the
main() thread?

Unless it is a dangling pointer issue, the only way I can think to get
these sort of weird effects is modifying the graphics context from a
non-main() thread context, which it seems you are not doing.



> So now the code looks like this:
> startButton->deactivate();
> addMessage(gui.getTranslation().Translate(u8"Connected!").c_str());
>
> Now there are no artifacts at all. The addMessage() method is following:
> void GUIDlgNetClient::addMessage(std::string msg)
> {
>     netMessages->insert(msg.c_str());
>     netMessages->insert(u8"\n");
>     Fl::check();
> }

And this all happens in the context of the main() thread?
For example, it is never safe to call Fl::check(); from any non-main
thread context.

Actually, if this is all happening in the callback, I'd not call
Fl::check(); at all anyway, TBH.

-- 
You received this message because you are subscribed to the Google Groups "fltk.general" group.
To unsubscribe from this group and stop receiving emails from it, send an email to fltkgeneral+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/fltkgeneral/CAGFM6dbAeq3F_sR5i6EfuddGytkABy%2BWX5ZE%2BbFoyJfnXZjKtw%40mail.gmail.com.
Direct Link to Message ]
 
     
Previous Message ]New Message | Reply ]Next Message ]
 
 

Comments are owned by the poster. All other content is copyright 1998-2024 by Bill Spitzak and others. This project is hosted by The FLTK Team. Please report site problems to 'erco@seriss.com'.