summaryrefslogtreecommitdiff
path: root/indra/llui
diff options
context:
space:
mode:
Diffstat (limited to 'indra/llui')
-rw-r--r--indra/llui/llfiltereditor.h1
-rw-r--r--indra/llui/llfloater.cpp2
-rw-r--r--indra/llui/llnotifications.cpp41
-rw-r--r--indra/llui/llnotifications.h36
-rw-r--r--indra/llui/llnotificationslistener.cpp10
-rw-r--r--indra/llui/llsearcheditor.cpp8
-rw-r--r--indra/llui/llsearcheditor.h2
-rw-r--r--indra/llui/lltooltip.cpp10
8 files changed, 66 insertions, 44 deletions
diff --git a/indra/llui/llfiltereditor.h b/indra/llui/llfiltereditor.h
index 3a05bc05a1..52cad3bff4 100644
--- a/indra/llui/llfiltereditor.h
+++ b/indra/llui/llfiltereditor.h
@@ -43,6 +43,7 @@ class LLFilterEditor : public LLSearchEditor
public:
struct Params : public LLInitParam::Block<Params, LLSearchEditor::Params>
{};
+ virtual ~LLFilterEditor() {}
protected:
LLFilterEditor(const Params&);
diff --git a/indra/llui/llfloater.cpp b/indra/llui/llfloater.cpp
index 2303cd24b7..c67db54ea6 100644
--- a/indra/llui/llfloater.cpp
+++ b/indra/llui/llfloater.cpp
@@ -1772,6 +1772,8 @@ void LLFloater::onClickTearOff(LLFloater* self)
{
if (self->mSaveRect)
{
+ LLRect screen_rect = self->calcScreenRect();
+ self->mPosition = LLCoordGL(screen_rect.getCenterX(), screen_rect.getCenterY()).convert();
self->storeRectControl();
}
self->setMinimized(FALSE); // to reenable minimize button if it was minimized
diff --git a/indra/llui/llnotifications.cpp b/indra/llui/llnotifications.cpp
index d736aa6634..d87241a9bf 100644
--- a/indra/llui/llnotifications.cpp
+++ b/indra/llui/llnotifications.cpp
@@ -994,6 +994,7 @@ LLBoundListener LLNotificationChannelBase::connectChangedImpl(const LLEventListe
// all of the notifications that are already in the channel
// we use a special signal called "load" in case the channel wants to care
// only about new notifications
+ LLMutexLock lock(&mItemsMutex);
for (LLNotificationSet::iterator it = mItems.begin(); it != mItems.end(); ++it)
{
slot(LLSD().with("sigtype", "load").with("id", (*it)->id()));
@@ -1171,29 +1172,33 @@ LLNotificationChannel::LLNotificationChannel(const std::string& name,
connectToChannel(parent);
}
-bool LLNotificationChannel::isEmpty() const
+LLNotificationChannel::~LLNotificationChannel()
{
- return mItems.empty();
+ for (LLBoundListener &listener : mListeners)
+ {
+ listener.disconnect();
+ }
}
-S32 LLNotificationChannel::size() const
+bool LLNotificationChannel::isEmpty() const
{
- return mItems.size();
+ return mItems.empty();
}
-LLNotificationChannel::Iterator LLNotificationChannel::begin()
+S32 LLNotificationChannel::size() const
{
- return mItems.begin();
+ return mItems.size();
}
-LLNotificationChannel::Iterator LLNotificationChannel::end()
+size_t LLNotificationChannel::size()
{
- return mItems.end();
+ return mItems.size();
}
-size_t LLNotificationChannel::size()
+void LLNotificationChannel::forEachNotification(NotificationProcess process)
{
- return mItems.size();
+ LLMutexLock lock(&mItemsMutex);
+ std::for_each(mItems.begin(), mItems.end(), process);
}
std::string LLNotificationChannel::summarize()
@@ -1201,7 +1206,8 @@ std::string LLNotificationChannel::summarize()
std::string s("Channel '");
s += mName;
s += "'\n ";
- for (LLNotificationChannel::Iterator it = begin(); it != end(); ++it)
+ LLMutexLock lock(&mItemsMutex);
+ for (LLNotificationChannel::Iterator it = mItems.begin(); it != mItems.end(); ++it)
{
s += (*it)->summarize();
s += "\n ";
@@ -1213,14 +1219,14 @@ void LLNotificationChannel::connectToChannel( const std::string& channel_name )
{
if (channel_name.empty())
{
- LLNotifications::instance().connectChanged(
- boost::bind(&LLNotificationChannelBase::updateItem, this, _1));
+ mListeners.push_back(LLNotifications::instance().connectChanged(
+ boost::bind(&LLNotificationChannelBase::updateItem, this, _1)));
}
else
{
mParents.push_back(channel_name);
LLNotificationChannelPtr p = LLNotifications::instance().getChannel(channel_name);
- p->connectChanged(boost::bind(&LLNotificationChannelBase::updateItem, this, _1));
+ mListeners.push_back(p->connectChanged(boost::bind(&LLNotificationChannelBase::updateItem, this, _1)));
}
}
@@ -1728,6 +1734,7 @@ void LLNotifications::cancel(LLNotificationPtr pNotif)
void LLNotifications::cancelByName(const std::string& name)
{
+ LLMutexLock lock(&mItemsMutex);
std::vector<LLNotificationPtr> notifs_to_cancel;
for (LLNotificationSet::iterator it=mItems.begin(), end_it = mItems.end();
it != end_it;
@@ -1752,6 +1759,7 @@ void LLNotifications::cancelByName(const std::string& name)
void LLNotifications::cancelByOwner(const LLUUID ownerId)
{
+ LLMutexLock lock(&mItemsMutex);
std::vector<LLNotificationPtr> notifs_to_cancel;
for (LLNotificationSet::iterator it = mItems.begin(), end_it = mItems.end();
it != end_it;
@@ -1799,11 +1807,6 @@ LLNotificationPtr LLNotifications::find(LLUUID uuid)
}
}
-void LLNotifications::forEachNotification(NotificationProcess process)
-{
- std::for_each(mItems.begin(), mItems.end(), process);
-}
-
std::string LLNotifications::getGlobalString(const std::string& key) const
{
GlobalStringMap::const_iterator it = mGlobalStrings.find(key);
diff --git a/indra/llui/llnotifications.h b/indra/llui/llnotifications.h
index 921398a693..4d71d189f2 100644
--- a/indra/llui/llnotifications.h
+++ b/indra/llui/llnotifications.h
@@ -738,16 +738,19 @@ class LLNotificationChannelBase :
{
LOG_CLASS(LLNotificationChannelBase);
public:
- LLNotificationChannelBase(LLNotificationFilter filter)
- : mFilter(filter),
- mItems()
- {}
+ LLNotificationChannelBase(LLNotificationFilter filter)
+ : mFilter(filter)
+ , mItems()
+ , mItemsMutex()
+ {}
+
virtual ~LLNotificationChannelBase()
{
// explicit cleanup for easier issue detection
mChanged.disconnect_all_slots();
mPassedFilter.disconnect_all_slots();
mFailedFilter.disconnect_all_slots();
+ LLMutexLock lock(&mItemsMutex);
mItems.clear();
}
// you can also connect to a Channel, so you can be notified of
@@ -786,6 +789,7 @@ protected:
LLStandardSignal mChanged;
LLStandardSignal mPassedFilter;
LLStandardSignal mFailedFilter;
+ LLMutex mItemsMutex;
// these are action methods that subclasses can override to take action
// on specific types of changes; the management of the mItems list is
@@ -835,7 +839,7 @@ public:
LLNotificationChannel(const Params& p = Params());
LLNotificationChannel(const std::string& name, const std::string& parent, LLNotificationFilter filter);
- virtual ~LLNotificationChannel() {}
+ virtual ~LLNotificationChannel();
typedef LLNotificationSet::iterator Iterator;
std::string getName() const { return mName; }
@@ -844,21 +848,23 @@ public:
{
return boost::iterator_range<parents_iter>(mParents);
}
-
- void connectToChannel(const std::string& channel_name);
-
+
bool isEmpty() const;
S32 size() const;
-
- Iterator begin();
- Iterator end();
- size_t size();
-
+ size_t size();
+
+ typedef boost::function<void(LLNotificationPtr)> NotificationProcess;
+ void forEachNotification(NotificationProcess process);
+
std::string summarize();
+protected:
+ void connectToChannel(const std::string& channel_name);
+
private:
std::string mName;
std::vector<std::string> mParents;
+ std::vector<LLBoundListener> mListeners;
};
// An interface class to provide a clean linker seam to the LLNotifications class.
@@ -924,10 +930,6 @@ public:
void update(const LLNotificationPtr pNotif);
LLNotificationPtr find(LLUUID uuid);
-
- typedef boost::function<void (LLNotificationPtr)> NotificationProcess;
-
- void forEachNotification(NotificationProcess process);
// This is all stuff for managing the templates
// take your template out
diff --git a/indra/llui/llnotificationslistener.cpp b/indra/llui/llnotificationslistener.cpp
index e73ba1fbe9..83b5bf03ac 100644
--- a/indra/llui/llnotificationslistener.cpp
+++ b/indra/llui/llnotificationslistener.cpp
@@ -149,11 +149,11 @@ void LLNotificationsListener::listChannelNotifications(const LLSD& params) const
if (channel)
{
LLSD notifications(LLSD::emptyArray());
- for (LLNotificationChannel::Iterator ni(channel->begin()), nend(channel->end());
- ni != nend; ++ni)
- {
- notifications.append(asLLSD(*ni));
- }
+ std::function<void(LLNotificationPtr)> func = [notifications](LLNotificationPtr ni) mutable
+ {
+ notifications.append(asLLSD(ni));
+ };
+ channel->forEachNotification(func);
response["notifications"] = notifications;
}
LLEventPumps::instance().obtain(params["reply"]).post(response);
diff --git a/indra/llui/llsearcheditor.cpp b/indra/llui/llsearcheditor.cpp
index bafeef41fb..7a88ecc76f 100644
--- a/indra/llui/llsearcheditor.cpp
+++ b/indra/llui/llsearcheditor.cpp
@@ -104,6 +104,14 @@ LLSearchEditor::LLSearchEditor(const LLSearchEditor::Params& p)
}
}
+LLSearchEditor::~LLSearchEditor()
+{
+ mSearchButton = NULL;
+ mClearButton = NULL;
+ mSearchEditor->deleteAllChildren();
+ deleteAllChildren();
+}
+
//virtual
void LLSearchEditor::draw()
{
diff --git a/indra/llui/llsearcheditor.h b/indra/llui/llsearcheditor.h
index c0f3c1d60c..bd51988d07 100644
--- a/indra/llui/llsearcheditor.h
+++ b/indra/llui/llsearcheditor.h
@@ -74,7 +74,7 @@ protected:
friend class LLUICtrlFactory;
public:
- virtual ~LLSearchEditor() {}
+ virtual ~LLSearchEditor();
/*virtual*/ void draw();
diff --git a/indra/llui/lltooltip.cpp b/indra/llui/lltooltip.cpp
index a6552d4ff1..328d36c6e1 100644
--- a/indra/llui/lltooltip.cpp
+++ b/indra/llui/lltooltip.cpp
@@ -440,7 +440,13 @@ void LLToolTipMgr::createToolTip(const LLToolTip::Params& params)
tooltip_params.rect = LLRect (0, 1, 1, 0);
if (tooltip_params.create_callback.isProvided())
- mToolTip = tooltip_params.create_callback()(tooltip_params);
+ {
+ mToolTip = tooltip_params.create_callback()(tooltip_params);
+ if (mToolTip == NULL)
+ {
+ return;
+ }
+ }
else
mToolTip = LLUICtrlFactory::create<LLToolTip> (tooltip_params);
@@ -492,7 +498,7 @@ void LLToolTipMgr::show(const LLToolTip::Params& params)
{
if (!params.styled_message.isProvided()
&& (!params.message.isProvided() || params.message().empty())
- && !params.image.isProvided()) return;
+ && !params.image.isProvided() && !params.create_callback.isProvided()) return;
// fill in default tooltip params from tool_tip.xml
LLToolTip::Params params_with_defaults(params);