FLTK logo

Re: [fltk.coredev] reentrant calls with Fl_Window::resize

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.coredev  ]
 
Previous Message ]New Message | Reply ]Next Message ]

Re: reentrant calls with Fl_Window::resize Albrecht Schlosser Nov 22, 2021  
 
On 11/22/21 7:46 AM Evan Laforge wrote:
I was tracking down a bug and it turned out to be caused when I call
resize() on a window "from the outside" (so it's my program doing it,
rather than the OS doing it via a window drag).  On OS X (with fltk
head), it turns out that each call to resize() causes it to be called
twice, reentrantly.  I tried it on X11 (with fltk at 3bb34), and the
reentrant call doesn't happen, but resize gets called 4 times.

I can confirm this behavior.

I'm not sure if this is a bug or not, but it is a bit odd, and it did
cause a bug in my program, which wasn't expecting reentrant calls.

I believe it is a bug. If your derived class calls Fl_Window::resize() in its own resize() method it should not be called back by this. In the theory you are supposed to *react* on the resize request sent by the system. If you call Fl_Window::resize() (the base class) this *should* confirm the resize request and not send another one.

I could track it down to a point (actually two) in src/Fl_cocoa.mm but I'm not sure it this is the right fix.

@Manolo: I'm attaching my modified test program and a potential workaround in the diff file. This should help to track down the problem. TIA.

Note: I'm aware that this is very likely not the correct solution, I assume you may find a better one.

--
You received this message because you are subscribed to the Google Groups "fltk.coredev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to fltkcoredev+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/fltkcoredev/ef1db801-931d-d906-78bc-681fa85d506f%40online.de.
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'.