Bug #1893
closedWPopupMenu throws exception "WPopupMenu::exec(): already being executed."
0%
Description
Hi,
current wt-3.3.0 (git version from 18th april) throws the "already being executed" if a popup menu is shown and you click again the widget which will trigger the popup to be shown. In older version the popup menu disappeared in that case. Now the exception in thrown and the session is destroyed!
The old behaviour was just fine for me, thus I would be happy if you can provide a patch to solve this problem soon!
Regards,
Stefan
Updated by Wim Dumon over 11 years ago
- Status changed from New to Feedback
Not sure what the exact situation is here... Calling exec() again while an other exec() has not yet returned is not supported. You can of course write a try/catch around the exec() call to catch the exception.
We recommend against using exec() since it locks a thread (and therefore does not scale to many users). The recommended way is to call show(). Calling show() twice should not throw.
Maybe a small example could clarify your situation?
Wim.
Updated by Stefan Ruppert over 11 years ago
Wim Dumon wrote:
Not sure what the exact situation is here... Calling exec() again while an other exec() has not yet returned is not supported. You can of course write a try/catch around the exec() call to catch the exception.
We recommend against using exec() since it locks a thread (and therefore does not scale to many users). The recommended way is to call show(). Calling show() twice should not throw.
Ok, I understand. But with wt-3.2.3 using WPopupMenu::exec() did not throw an exception. I tried it with catching the execption, but this leaves the recursiveEventLoop_ variable set to true. And I cannot open the popup menu anymore...
Also using WPopupMenu::popup() does not work.
Maybe a small example could clarify your situation?
Here is my usage scenario in few words:
MyClass::MyClass()
{
label_ = new WLabel("Menu");
popup_ = new WPopupMenu();
popup_->addItem("About...");
label->clicked().connect(popup, &MyClass::popup);
}
void MyClass::popup()
{
try {
popup*->exec(label*, Wt::Vertical);
// throws an execption if clicking on the Menu-Label
// if the popup is still open
} catch(const WException& ex) {
// now hide it, maybe it should be canceled, but cancel() is private!
popup_->setHidden(true);
// after catching the execption I can't open the
// popup again by clicking on the Menu-Label...
}
}
If I use WMenuPopup::popup() clicking on the Menu-Label during
the popup is shown it will disappear, but I can't open it again
by clicking on the Menu-Label...
Stefan
Updated by Stefan Ruppert over 11 years ago
Hi,
I had some time to investigate this problem further and I came across the new WPopupMenu::setButton() method and if used all things work fine.
It would be great if you can add new methods in the ChangeLog of a release or mark in the doxygen documentation the version the method was added! (@since 3.3.0)!
Thus this ticket can be closed from my side.
Regards,
Stefan
Updated by Koen Deforche over 11 years ago
- Status changed from Feedback to Closed