Skip to content

Commit

Permalink
Don't accept signals from hidden widgets, and don't propagate their f…
Browse files Browse the repository at this point in the history
…orm value
  • Loading branch information
RockinRoel committed Jul 28, 2017
1 parent b263ccc commit 9b7bce4
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
11 changes: 5 additions & 6 deletions src/Wt/WApplication.C
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
#include "Wt/WDate"
#include "Wt/WDefaultLoadingIndicator"
#include "Wt/WException"
#include "Wt/WFileUpload"
#include "Wt/WMemoryResource"
#include "Wt/WServer"
#include "Wt/WTimer"
Expand Down Expand Up @@ -517,13 +518,11 @@ void WApplication::removeGlobalWidget(WWidget *)

bool WApplication::isExposed(WWidget *w) const
{
/*
* This not right: for example a file upload is usually hidden while
* uploading, but then could not receive the upload event
if (!w->isVisible())
// File uploads may be hidden when emitting a signal.
// Other hidden widgets should not emit signals.
if (!w->isVisible() && !dynamic_cast<WFileUpload*>(w))
return false;
*/

if (!w->isEnabled())
return false;

Expand Down
4 changes: 2 additions & 2 deletions src/web/WebSession.C
Original file line number Diff line number Diff line change
Expand Up @@ -2850,8 +2850,8 @@ void WebSession::propagateFormValues(const WEvent& e, const std::string& se)

if (!request.postDataExceeded()) {
WWidget *w = dynamic_cast<WWidget*>(obj);
if (w && !w->isEnabled())
continue; // Do not update form data of a disabled widget
if (w && (!w->isEnabled() || !w->isVisible()))
continue; // Do not update form data of a disabled or invisible widget
obj->setFormData(getFormData(request, se + formName));
} else
obj->setRequestTooLarge(request.postDataExceeded());
Expand Down

0 comments on commit 9b7bce4

Please sign in to comment.