Update childSetCommitCallback to upstream version, fixes the issue of crashing out upon using spinners in the colorpicker

This commit is contained in:
Lirusaito
2013-06-23 22:14:35 -04:00
parent 64cb1109e2
commit 64bd7af0ca
2 changed files with 13 additions and 4 deletions

View File

@@ -754,12 +754,16 @@ BOOL LLPanel::childHasFocus(const std::string& id)
}
}
void LLPanel::childSetCommitCallback(const std::string& id, void (*cb)(LLUICtrl*, void*), void *userdata )
// *TODO: Deprecate; for backwards compatability only:
// Prefer getChild<LLUICtrl>("foo")->setCommitCallback(boost:bind(...)),
// which takes a generic slot. Or use mCommitCallbackRegistrar.add() with
// a named callback and reference it in XML.
void LLPanel::childSetCommitCallback(const std::string& id, boost::function<void (LLUICtrl*,void*)> cb, void* data)
{
LLUICtrl* child = getChild<LLUICtrl>(id, true);
LLUICtrl* child = findChild<LLUICtrl>(id);
if (child)
{
child->setCommitCallback(cb, userdata);
child->setCommitCallback(boost::bind(cb, child, data));
}
}

View File

@@ -170,7 +170,12 @@ public:
void childSetFocus(const std::string& id, BOOL focus = TRUE);
BOOL childHasFocus(const std::string& id);
void childSetCommitCallback(const std::string& id, void (*cb)(LLUICtrl*, void*), void* userdata = NULL );
// *TODO: Deprecate; for backwards compatability only:
// Prefer getChild<LLUICtrl>("foo")->setCommitCallback(boost:bind(...)),
// which takes a generic slot. Or use mCommitCallbackRegistrar.add() with
// a named callback and reference it in XML.
void childSetCommitCallback(const std::string& id, boost::function<void (LLUICtrl*,void*)> cb, void* data = NULL);
void childSetValidate(const std::string& id, BOOL (*cb)(LLUICtrl*, void*) );
void childSetColor(const std::string& id, const LLColor4& color);