[AD] win32 allegro_exit() blocks on non-active Window |
[ Thread Index |
Date Index
| More lists.liballeg.org/allegro-developers Archives
]
when i call allegro_exit() it blocks until its made the active window.
by the time i have started to exit my program, the window disappears and
there is still some work to be done, but from the users point of view the
window is gone and therefore the program shut (in the users
view)..... now the user clicks on some other Windows program, but the
allegro program continues until it gets to allegro_exit() where it blocks
until its made the active window again. (by clicking its task in the task
bar).
why must it be the active window ?
i have no idea what the real reason for it is, but here is what i have
found so far...
in exit_directx_window() in /allegro/src/win/wwnd.c
i found this:
/* destroy the window: we cannot directly use
* DestroyWindow() because we are not running
* in the same thread as that of the window.
*/
PostMessage(allegro_wnd, msg_suicide, 0, 0);
/* wait until the window thread ends */
WaitForSingleObject(wnd_thread, INFINITE);
-----
idea: would using win32::PostThreadMessage() fix my problem ?
does the current code block because the allegro_wnd is switched out and
therefore not processing its messages ?
or does Windows not post the message into the allegro_wnd's queue while its
not an active window ?
-------------
why does code in exit_directx_window() in /allegro/src/win/wwnd.c
attempt to shutdown the allegro_wnd when i have already removed it by
calling set_gfx_mode(TEXT)
could this PostMessage() be avoided by checking if the allegro_wnd has
been shutdown already by a call to set_gfx_mode(TEXT)
?? does set_gfx_mode(TEXT) attempt to DestroyWindow() if not, why not ?