Added implementation of _set_menu_sem_() to Window.cpp (should it go to a different place ?), thus fixing the build (at least here, I hope I didn't forget anything else).
Thanks to Bill Hayden for reporting and sorry again for the trouble. Changed a comment in PopUpMenu.cpp git-svn-id: file:///srv/svn/repos/haiku/trunk/current@8394 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -21,6 +21,7 @@
|
||||
//
|
||||
// File Name: PopUpMenu.cpp
|
||||
// Author: Marc Flerackers ([email protected])
|
||||
// Stefano Ceccherini ([email protected])
|
||||
// Description: BPopUpMenu represents a menu that pops up when you
|
||||
// activate it.
|
||||
//------------------------------------------------------------------------------
|
||||
@@ -297,9 +298,8 @@ BPopUpMenu::_go(BPoint where, bool autoInvoke, bool startOpened,
|
||||
popup_menu_data *data = new popup_menu_data;
|
||||
sem_id sem = create_sem(0, "window close lock");
|
||||
|
||||
// Asynchronous menu: we set the BWindow semaphore
|
||||
// and let BWindow do the job for us (??? this is what
|
||||
// it's probably happening, _set_menu_sem_() is undocumented)
|
||||
// Asynchronous menu: we set the BWindow menu's semaphore
|
||||
// and let BWindow block when needed
|
||||
if (async) {
|
||||
data->window = window;
|
||||
_set_menu_sem_(window, sem);
|
||||
@@ -330,10 +330,14 @@ BPopUpMenu::_go(BPoint where, bool autoInvoke, bool startOpened,
|
||||
delete data;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// Synchronous menu: we block on the sem till
|
||||
// the other thread deletes it.
|
||||
if (!async) {
|
||||
if (window) {
|
||||
// TODO: usually it's not a good idea to check for a particular error
|
||||
// code. Though here we just want to wait till the semaphore is deleted
|
||||
// (it will return B_BAD_SEM_ID in that case), not provide locking or whatever.
|
||||
while (acquire_sem_etc(sem, 1, B_TIMEOUT, 50000) != B_BAD_SEM_ID)
|
||||
window->UpdateIfNeeded();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user