From 64bd7af0ca43c2332352a5cbfa104831ca5930ef Mon Sep 17 00:00:00 2001 From: Lirusaito Date: Sun, 23 Jun 2013 22:14:35 -0400 Subject: [PATCH] Update childSetCommitCallback to upstream version, fixes the issue of crashing out upon using spinners in the colorpicker --- indra/llui/llpanel.cpp | 10 +++++++--- indra/llui/llpanel.h | 7 ++++++- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/indra/llui/llpanel.cpp b/indra/llui/llpanel.cpp index 0e6a4514c..eb5362a88 100644 --- a/indra/llui/llpanel.cpp +++ b/indra/llui/llpanel.cpp @@ -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("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 cb, void* data) { - LLUICtrl* child = getChild(id, true); + LLUICtrl* child = findChild(id); if (child) { - child->setCommitCallback(cb, userdata); + child->setCommitCallback(boost::bind(cb, child, data)); } } diff --git a/indra/llui/llpanel.h b/indra/llui/llpanel.h index 3080eb594..eac7d12a8 100644 --- a/indra/llui/llpanel.h +++ b/indra/llui/llpanel.h @@ -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("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 cb, void* data = NULL); + void childSetValidate(const std::string& id, BOOL (*cb)(LLUICtrl*, void*) ); void childSetColor(const std::string& id, const LLColor4& color);