| [ Return to Bugs & Features | Roadmap 1.3 | SVN ⇄ GIT ]
STR #3165
Application: | FLTK Library |
Status: | 1 - Closed w/Resolution |
Priority: | 2 - Low, e.g. a documentation error or undocumented side-effect |
Scope: | 2 - Specific to an operating system |
Subsystem: | WIN32 |
Summary: | process does not end after closing all windows |
Version: | 1.3-current |
Created By: | Belgiansteve |
Assigned To: | manolo |
Fix Version: | 1.3-current (SVN: v10697) |
Update Notification: | |
Trouble Report Files:
|
#1 | Belgiansteve 13:21 Nov 28, 2014 |
| ex01.cpp 1k | |
Trouble Report Comments:
|
#1 | Belgiansteve 13:21 Nov 28, 2014 |
| The attached file shows an example program for which the process does not terminate after closing all windows, when the main window is closed first. To reproduce the error: - Run the program. - Create two (or more) child windows (note they are non-modal). - Close the main window. - Close all child windows.
After this, the process does not end. I only tried this on Win7, using FLTK 1.3.3. Not sure if it happens on other OS.
Thanks,
Steve | |
|
#2 | Belgiansteve 16:11 Nov 28, 2014 |
| Hi everyone,
I think I found the problem. The problem is a fix to an earlier STR #3097 that does not restore the proper window ownership relationship.
In Fl.cxx, line 1585, the code reads: for (int ii = 0; ii < count; ii++) { doit[ii]->hide(); doit[ii]->show(); } if (count) delete [] doit;
The problem here is that when the first window is shown (ii==0) the other child windows are still on the screen and it tries to make one of these child windows the parent (in Fl::make()) and Windows does not like that: CreateWindowEx returns NULL in Fl::make() (there should probably be a check for this). The solution is: if (count) { for (int ii = 0; ii < count; ii++) doit[ii]->hide(); for (int ii = 0; ii < count; ii++) { if (ii!=0) doit[0]->show(); doit[ii]->show(); } delete[] doit; } This first hide all the windows which seems to avoid the issue. This makes the first window the parent of all the other non-modal windows. Note that I had to call show() on the first window in each iteration, since FLTK apparently makes the last shown() window the parent of any non-modal windows. Without this, a chain of non-modal windows is created that would make this entire issue even more complex. Now, I think this still keeps the first window a non-modal window (at least as far as FLTK is concerned. Perhaps calling clear_modal_states() on this first window is necessary?)
This implements the idea that when the window to which other windows are modal is closed, it makes one of these dependent windows a normal window, and makes the other modal windows modal to this window (if you follow what I'm saying). Not sure if that is the desired behavior. What would happen on other OS? Anyways, this does seem to fix the issue.
Best,
Steve | |
|
#3 | manolo 01:35 Apr 13, 2015 |
| Fixed in Subversion repository.
Thanks for the solution. | |
[ Return to Bugs & Features ]
|
| |