aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/FbTk/LogicCommands.cc8
-rw-r--r--src/FbTk/MacroCommand.cc2
-rw-r--r--src/FbTk/RefCount.hh6
-rw-r--r--src/FocusableList.cc2
-rw-r--r--src/Keys.cc2
5 files changed, 9 insertions, 11 deletions
diff --git a/src/FbTk/LogicCommands.cc b/src/FbTk/LogicCommands.cc
index bda67f5..121823f 100644
--- a/src/FbTk/LogicCommands.cc
+++ b/src/FbTk/LogicCommands.cc
@@ -43,7 +43,7 @@ M *addCommands(M *macro, const string &args, bool trusted) {
43 43
44 std::vector<std::string>::iterator it = cmds.begin(), it_end = cmds.end(); 44 std::vector<std::string>::iterator it = cmds.begin(), it_end = cmds.end();
45 for (; it != it_end; ++it) { 45 for (; it != it_end; ++it) {
46 cmd = CommandParser<bool>::instance().parse(*it, trusted); 46 cmd.reset( CommandParser<bool>::instance().parse(*it, trusted) );
47 if (cmd) 47 if (cmd)
48 macro->add(cmd); 48 macro->add(cmd);
49 } 49 }
@@ -90,13 +90,13 @@ Command<void> *IfCommand::parse(const std::string &command, const std::string &a
90 if (cmds.size() < 2) 90 if (cmds.size() < 2)
91 return 0; 91 return 0;
92 92
93 cond = CommandParser<bool>::instance().parse(cmds[0], trusted); 93 cond.reset( CommandParser<bool>::instance().parse(cmds[0], trusted) );
94 if (cond == 0) 94 if (cond == 0)
95 return 0; 95 return 0;
96 96
97 t = CommandParser<void>::instance().parse(cmds[1], trusted); 97 t.reset( CommandParser<void>::instance().parse(cmds[1], trusted) );
98 if (cmds.size() >= 3) 98 if (cmds.size() >= 3)
99 f = CommandParser<void>::instance().parse(cmds[2], trusted); 99 f.reset( CommandParser<void>::instance().parse(cmds[2], trusted) );
100 if (t == 0 && f == 0) 100 if (t == 0 && f == 0)
101 return 0; 101 return 0;
102 102
diff --git a/src/FbTk/MacroCommand.cc b/src/FbTk/MacroCommand.cc
index e04d92a..549f2da 100644
--- a/src/FbTk/MacroCommand.cc
+++ b/src/FbTk/MacroCommand.cc
@@ -41,7 +41,7 @@ M *addCommands(M *macro, const std::string &args, bool trusted) {
41 if (remainder.length() == 0) { 41 if (remainder.length() == 0) {
42 std::list<std::string>::iterator it = cmds.begin(), it_end = cmds.end(); 42 std::list<std::string>::iterator it = cmds.begin(), it_end = cmds.end();
43 for (; it != it_end; ++it) { 43 for (; it != it_end; ++it) {
44 cmd = CommandParser<void>::instance().parse(*it, trusted); 44 cmd.reset( CommandParser<void>::instance().parse(*it, trusted) );
45 if (cmd) 45 if (cmd)
46 macro->add(cmd); 46 macro->add(cmd);
47 } 47 }
diff --git a/src/FbTk/RefCount.hh b/src/FbTk/RefCount.hh
index 2595864..cc8c917 100644
--- a/src/FbTk/RefCount.hh
+++ b/src/FbTk/RefCount.hh
@@ -37,11 +37,10 @@ public:
37 RefCount(const RefCount<Pointer2> &copy); 37 RefCount(const RefCount<Pointer2> &copy);
38 ~RefCount(); 38 ~RefCount();
39 RefCount<Pointer> &operator = (const RefCount<Pointer> &copy); 39 RefCount<Pointer> &operator = (const RefCount<Pointer> &copy);
40 RefCount<Pointer> &operator = (Pointer *p);
41 Pointer &operator * () const { return *get(); } 40 Pointer &operator * () const { return *get(); }
42 Pointer *operator -> () const { return get(); } 41 Pointer *operator -> () const { return get(); }
43 Pointer *get() const { return m_data; } 42 Pointer *get() const { return m_data; }
44 void reset(Pointer *p) { *this = p; } 43 void reset(Pointer *p = 0);
45 /// conversion to "bool" 44 /// conversion to "bool"
46 operator bool_type() const { return m_data ? &RefCount::m_data : 0; } 45 operator bool_type() const { return m_data ? &RefCount::m_data : 0; }
47 46
@@ -100,12 +99,11 @@ RefCount<Pointer> &RefCount<Pointer>::operator = (const RefCount<Pointer> &copy)
100} 99}
101 100
102template <typename Pointer> 101template <typename Pointer>
103RefCount<Pointer> &RefCount<Pointer>::operator = (Pointer *p) { 102void RefCount<Pointer>::reset(Pointer *p) {
104 decRefCount(); 103 decRefCount();
105 m_data = p; // set data pointer 104 m_data = p; // set data pointer
106 m_refcount = new unsigned int(0); // create new counter 105 m_refcount = new unsigned int(0); // create new counter
107 incRefCount(); 106 incRefCount();
108 return *this;
109} 107}
110 108
111template <typename Pointer> 109template <typename Pointer>
diff --git a/src/FocusableList.cc b/src/FocusableList.cc
index 77ff247..3373890 100644
--- a/src/FocusableList.cc
+++ b/src/FocusableList.cc
@@ -255,7 +255,7 @@ void FocusableList::attachSignals(Focusable &win) {
255 FbTk::RefCount<FbTk::SignalTracker> &tracker = m_signal_map[&win]; 255 FbTk::RefCount<FbTk::SignalTracker> &tracker = m_signal_map[&win];
256 if (! tracker) { 256 if (! tracker) {
257 // we have not attached to this window yet 257 // we have not attached to this window yet
258 tracker = new SignalTracker; 258 tracker.reset(new SignalTracker);
259 tracker->join(win.titleSig(), MemFunSelectArg1(*this, &FocusableList::updateTitle)); 259 tracker->join(win.titleSig(), MemFunSelectArg1(*this, &FocusableList::updateTitle));
260 tracker->join(win.dieSig(), MemFun(*this, &FocusableList::remove)); 260 tracker->join(win.dieSig(), MemFun(*this, &FocusableList::remove));
261 if(fbwin) { 261 if(fbwin) {
diff --git a/src/Keys.cc b/src/Keys.cc
index 0c20f9e..6bb0e42 100644
--- a/src/Keys.cc
+++ b/src/Keys.cc
@@ -518,7 +518,7 @@ bool Keys::addBinding(const string &linebuffer) {
518 const char *str = FbTk::StringUtil::strcasestr(linebuffer.c_str(), 518 const char *str = FbTk::StringUtil::strcasestr(linebuffer.c_str(),
519 val[argc].c_str()); 519 val[argc].c_str());
520 if (str) // +1 to skip ':' 520 if (str) // +1 to skip ':'
521 current_key->m_command = FbTk::CommandParser<void>::instance().parse(str + 1); 521 current_key->m_command.reset(FbTk::CommandParser<void>::instance().parse(str + 1));
522 522
523 if (!str || current_key->m_command == 0 || mod) { 523 if (!str || current_key->m_command == 0 || mod) {
524 delete first_new_key; 524 delete first_new_key;