summaryrefslogtreecommitdiffstats
path: root/src/debug
diff options
context:
space:
mode:
Diffstat (limited to 'src/debug')
-rw-r--r--src/debug/event.h10
-rw-r--r--src/debug/logger.cpp6
-rw-r--r--src/debug/simple-event.h12
3 files changed, 18 insertions, 10 deletions
diff --git a/src/debug/event.h b/src/debug/event.h
index de5cddd07..ff049d71c 100644
--- a/src/debug/event.h
+++ b/src/debug/event.h
@@ -13,6 +13,8 @@
#ifndef SEEN_INKSCAPE_DEBUG_EVENT_H
#define SEEN_INKSCAPE_DEBUG_EVENT_H
+#include <memory>
+#include <string>
#include <utility>
#include "util/share.h"
@@ -41,14 +43,14 @@ public:
struct PropertyPair {
public:
PropertyPair() = default;
- PropertyPair(char const *n, Util::ptr_shared v)
- : name(n), value(v) {}
+ PropertyPair(char const *n, std::shared_ptr<std::string>&& v)
+ : name(n), value(std::move(v)) {}
PropertyPair(char const *n, char const *v)
: name(n),
- value(Util::share_string(v)) {}
+ value(std::move(std::make_shared<std::string>(v))) {}
char const *name;
- Util::ptr_shared value;
+ std::shared_ptr<std::string> value;
};
static Category category() { return OTHER; }
diff --git a/src/debug/logger.cpp b/src/debug/logger.cpp
index 13d79daa2..7c0990c2c 100644
--- a/src/debug/logger.cpp
+++ b/src/debug/logger.cpp
@@ -27,7 +27,7 @@ bool Logger::_category_mask[Event::N_CATEGORIES];
namespace {
-static void write_escaped_value(std::ostream &os, Util::ptr_shared value) {
+static void write_escaped_value(std::ostream &os, char const *value) {
for ( char const *current=value ; *current ; ++current ) {
switch (*current) {
case '&':
@@ -133,7 +133,7 @@ typedef SimpleEvent<Event::CORE> CoreEvent;
class SessionEvent : public CoreEvent {
public:
- SessionEvent() : CoreEvent(Util::share_static_string("session")) {
+ SessionEvent() : CoreEvent("session") {
_addProperty("inkscape-version", Inkscape::version_string);
}
};
@@ -173,7 +173,7 @@ void Logger::_start(Event const &event) {
for ( unsigned i = 0 ; i < property_count ; i++ ) {
Event::PropertyPair property=event.property(i);
log_stream << " " << property.name << "=\"";
- write_escaped_value(log_stream, property.value);
+ write_escaped_value(log_stream, property.value->c_str());
log_stream << "\"";
}
diff --git a/src/debug/simple-event.h b/src/debug/simple-event.h
index 70bef77e9..1b6dc172c 100644
--- a/src/debug/simple-event.h
+++ b/src/debug/simple-event.h
@@ -14,6 +14,8 @@
#define SEEN_INKSCAPE_DEBUG_SIMPLE_EVENT_H
#include <cstdarg>
+#include <memory>
+#include <string>
#include <vector>
#include <glib.h> // g_assert()
@@ -43,11 +45,15 @@ public:
void generateChildEvents() const override {}
protected:
+ // TODO: change all call sites for this method, and remove it.
void _addProperty(char const *name, Util::ptr_shared value) {
- _properties.push_back(PropertyPair(name, value));
+ _properties.push_back(PropertyPair(name, std::move(std::make_shared<std::string>(value.pointer()))));
+ }
+ void _addProperty(char const *name, std::shared_ptr<std::string>&& value) {
+ _properties.push_back(PropertyPair(name, std::move(value)));
}
void _addProperty(char const *name, char const *value) {
- _addProperty(name, Util::share_string(value));
+ _addProperty(name, std::move(std::make_shared<std::string>(value)));
}
void _addProperty(char const *name, long value) {
_addFormattedProperty(name, "%ld", value);
@@ -55,7 +61,7 @@ protected:
private:
char const *_name;
- std::vector<PropertyPair, GC::Alloc<PropertyPair, GC::AUTO> > _properties;
+ std::vector<PropertyPair> _properties;
void _addFormattedProperty(char const *name, char const *format, ...)
{