summaryrefslogtreecommitdiff
path: root/indra/llui
diff options
context:
space:
mode:
Diffstat (limited to 'indra/llui')
-rw-r--r--indra/llui/llnotifications.cpp27
-rw-r--r--indra/llui/llnotifications.h40
-rw-r--r--indra/llui/lltextbox.cpp2
-rw-r--r--indra/llui/lltextparser.cpp2
-rw-r--r--indra/llui/llview.cpp2
5 files changed, 48 insertions, 25 deletions
diff --git a/indra/llui/llnotifications.cpp b/indra/llui/llnotifications.cpp
index 2fd1056f20..2ae96726af 100644
--- a/indra/llui/llnotifications.cpp
+++ b/indra/llui/llnotifications.cpp
@@ -49,7 +49,7 @@ class LLNotificationHistoryChannel : public LLNotificationChannel
LOG_CLASS(LLNotificationHistoryChannel);
public:
LLNotificationHistoryChannel(const std::string& filename) :
- LLNotificationChannel("History", "Visible", &historyFilter),
+ LLNotificationChannel("History", "Visible", &historyFilter, LLNotificationComparators::orderByUUID()),
mFileName(filename)
{
connectChanged(boost::bind(&LLNotificationHistoryChannel::historyHandler, this, _1));
@@ -858,6 +858,20 @@ bool LLNotificationChannelBase::updateItem(const LLSD& payload, LLNotificationPt
return abortProcessing;
}
+/* static */
+LLNotificationChannelPtr LLNotificationChannel::buildChannel(const std::string& name,
+ const std::string& parent,
+ LLNotificationFilter filter,
+ LLNotificationComparator comparator)
+{
+ // note: this is not a leak; notifications are self-registering.
+ // This factory helps to prevent excess deletions by making sure all smart
+ // pointers to notification channels come from the same source
+ new LLNotificationChannel(name, parent, filter, comparator);
+ return LLNotifications::instance().getChannel(name);
+}
+
+
LLNotificationChannel::LLNotificationChannel(const std::string& name,
const std::string& parent,
LLNotificationFilter filter,
@@ -1054,21 +1068,22 @@ void LLNotifications::createDefaultChannels()
{
// now construct the various channels AFTER loading the notifications,
// because the history channel is going to rewrite the stored notifications file
- new LLNotificationChannel("Expiration", "",
+ LLNotificationChannel::buildChannel("Expiration", "",
boost::bind(&LLNotifications::expirationFilter, this, _1));
- new LLNotificationChannel("Unexpired", "",
+ LLNotificationChannel::buildChannel("Unexpired", "",
!boost::bind(&LLNotifications::expirationFilter, this, _1)); // use negated bind
- new LLNotificationChannel("Unique", "Unexpired",
+ LLNotificationChannel::buildChannel("Unique", "Unexpired",
boost::bind(&LLNotifications::uniqueFilter, this, _1));
- new LLNotificationChannel("Ignore", "Unique",
+ LLNotificationChannel::buildChannel("Ignore", "Unique",
filterIgnoredNotifications);
- new LLNotificationChannel("Visible", "Ignore",
+ LLNotificationChannel::buildChannel("Visible", "Ignore",
&LLNotificationFilters::includeEverything);
// create special history channel
//std::string notifications_log_file = gDirUtilp->getExpandedFilename ( LL_PATH_PER_SL_ACCOUNT, "open_notifications.xml" );
// use ^^^ when done debugging notifications serialization
std::string notifications_log_file = gDirUtilp->getExpandedFilename ( LL_PATH_USER_SETTINGS, "open_notifications.xml" );
+ // this isn't a leak, don't worry about the empty "new"
new LLNotificationHistoryChannel(notifications_log_file);
// connect action methods to these channels
diff --git a/indra/llui/llnotifications.h b/indra/llui/llnotifications.h
index cb5d2f6f34..bb379121cc 100644
--- a/indra/llui/llnotifications.h
+++ b/indra/llui/llnotifications.h
@@ -735,6 +735,13 @@ protected:
LLNotificationFilter mFilter;
};
+// The type of the pointers that we're going to manage in the NotificationQueue system
+// Because LLNotifications is a singleton, we don't actually expect to ever
+// destroy it, but if it becomes necessary to do so, the shared_ptr model
+// will ensure that we don't leak resources.
+class LLNotificationChannel;
+typedef boost::shared_ptr<LLNotificationChannel> LLNotificationChannelPtr;
+
// manages a list of notifications
// Note that if this is ever copied around, we might find ourselves with multiple copies
// of a queue with notifications being added to different nonequivalent copies. So we
@@ -742,8 +749,9 @@ protected:
//
// NOTE: LLNotificationChannel is self-registering. The *correct* way to create one is to
// do something like:
-// new LLNotificationChannel("name", "parent"...);
-// You can then retrieve the channel by using the registry:
+// LLNotificationChannel::buildChannel("name", "parent"...);
+// This returns an LLNotificationChannelPtr, which you can store, or
+// you can then retrieve the channel by using the registry:
// LLNotifications::instance().getChannel("name")...
//
class LLNotificationChannel :
@@ -754,13 +762,6 @@ class LLNotificationChannel :
public:
virtual ~LLNotificationChannel() {}
- // Notification Channels have a filter, which determines which notifications
- // will be added to this channel.
- // Channel filters cannot change.
- LLNotificationChannel(const std::string& name, const std::string& parent,
- LLNotificationFilter filter=LLNotificationFilters::includeEverything,
- LLNotificationComparator comparator=LLNotificationComparators::orderByUUID());
-
typedef LLNotificationSet::iterator Iterator;
std::string getName() const { return mName; }
@@ -777,6 +778,21 @@ public:
std::string summarize();
+ // factory method for constructing these channels; since they're self-registering,
+ // we want to make sure that you can't use new to make them
+ static LLNotificationChannelPtr buildChannel(const std::string& name, const std::string& parent,
+ LLNotificationFilter filter=LLNotificationFilters::includeEverything,
+ LLNotificationComparator comparator=LLNotificationComparators::orderByUUID());
+
+protected:
+ // Notification Channels have a filter, which determines which notifications
+ // will be added to this channel.
+ // Channel filters cannot change.
+ // Channels have a protected constructor so you can't make smart pointers that don't
+ // come from our internal reference; call NotificationChannel::build(args)
+ LLNotificationChannel(const std::string& name, const std::string& parent,
+ LLNotificationFilter filter, LLNotificationComparator comparator);
+
private:
std::string mName;
std::string mParent;
@@ -785,12 +801,6 @@ private:
-// The type of the pointers that we're going to manage in the NotificationQueue system
-// Because LLNotifications is a singleton, we don't actually expect to ever
-// destroy it, but if it becomes necessary to do so, the shared_ptr model
-// will ensure that we don't leak resources.
-typedef boost::shared_ptr<LLNotificationChannel> LLNotificationChannelPtr;
-
class LLNotifications :
public LLSingleton<LLNotifications>,
public LLNotificationChannelBase
diff --git a/indra/llui/lltextbox.cpp b/indra/llui/lltextbox.cpp
index 2348ef314c..89893bcf8d 100644
--- a/indra/llui/lltextbox.cpp
+++ b/indra/llui/lltextbox.cpp
@@ -431,7 +431,7 @@ LLView* LLTextBox::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *f
std::string font_style;
if (node->getAttributeString("font-style", font_style))
{
- text_box->mFontStyle |= LLFontGL::getStyleFromString(font_style);
+ text_box->mFontStyle = LLFontGL::getStyleFromString(font_style);
}
BOOL mouse_opaque = text_box->getMouseOpaque();
diff --git a/indra/llui/lltextparser.cpp b/indra/llui/lltextparser.cpp
index cc3fcd4d84..227d24a865 100644
--- a/indra/llui/lltextparser.cpp
+++ b/indra/llui/lltextparser.cpp
@@ -121,7 +121,7 @@ S32 LLTextParser::findPattern(const std::string &text, LLSD highlight)
pattern= utf8str_tolower(pattern);
}
- S32 found=std::string::npos;
+ size_t found=std::string::npos;
switch ((S32)highlight["condition"])
{
diff --git a/indra/llui/llview.cpp b/indra/llui/llview.cpp
index 699c76a09d..2350ea6050 100644
--- a/indra/llui/llview.cpp
+++ b/indra/llui/llview.cpp
@@ -1370,8 +1370,6 @@ void LLView::draw()
{
drawDebugRect();
}
-
- gGL.getTexUnit(0)->disable();
}
//Draw a box for debugging.