* Fixed memory leaks in Control, ElementMenu and TextElementBranch.

* Check if RLIMIT_AS is present, else use RLIMIT_DATA.

* Don't add one to the timeout in display::Window::mark_dirty() so
that it updates the display immediately upon reorganizing the layout.

* Updated doc/rtorrent.1.


git-svn-id: svn://rakshasa.no/libtorrent/trunk/rtorrent@759 e378c898-3ddf-0310-93e7-cc216c733640
This commit is contained in:
rakshasa
2006-08-15 23:15:47 +00:00
parent ee7016f547
commit 708e89ebad
8 changed files with 45 additions and 28 deletions
+3
View File
@@ -93,9 +93,12 @@ Control::~Control() {
delete m_commandScheduler;
delete m_variables;
delete m_viewManager;
delete m_ui;
delete m_display;
delete m_core;
delete m_scheduler;
delete m_clientInfo;
}
+1 -1
View File
@@ -121,7 +121,7 @@ Canvas::print(unsigned int x, unsigned int y, const char* str, ...) {
va_start(arglist, str);
wmove(m_window, y, x);
vw_printw(m_window, str, arglist);
vw_printw(m_window, const_cast<char*>(str), arglist);
va_end(arglist);
}
+2
View File
@@ -48,6 +48,7 @@ public:
TextElementBranchVoid(const slot_type& slot, TextElement* branch1, TextElement* branch2) :
m_slot(slot), m_branch1(branch1), m_branch2(branch2) {}
~TextElementBranchVoid() { delete m_branch1; delete m_branch2; }
virtual char* print(char* first, char* last, Canvas::attributes_list* attributes, void* object) {
if (m_slot())
@@ -76,6 +77,7 @@ public:
TextElementBranch(const slot_type& slot, TextElement* branch1, TextElement* branch2) :
m_slot(slot), m_branch1(branch1), m_branch2(branch2) {}
~TextElementBranch() { delete m_branch1; delete m_branch2; }
virtual char* print(char* first, char* last, Canvas::attributes_list* attributes, void* object) {
if (object == NULL)
+3 -1
View File
@@ -85,8 +85,10 @@ public:
bool is_width_dynamic() const { return m_maxWidth > m_minWidth; }
bool is_height_dynamic() const { return m_maxHeight > m_minHeight; }
// Do not call mark_dirty() from withing redraw() as it may cause
// infinite looping in the display scheduler.
bool is_dirty() { return m_taskUpdate.is_queued(); }
void mark_dirty() { if (!is_active()) return; m_slotSchedule(this, cachedTime + 1); }
void mark_dirty() { if (!is_active()) return; m_slotSchedule(this, cachedTime); }
extent_type min_width() const { return m_minWidth; }
extent_type min_height() const { return m_minHeight; }
+2 -1
View File
@@ -98,7 +98,8 @@ WindowHttpQueue::cleanup_list() {
else
++itr;
mark_dirty();
// Bad, can't have this here as it is called from redraw().
// mark_dirty();
}
std::string
+9 -18
View File
@@ -48,22 +48,15 @@
namespace ui {
struct ElementMenuEntry {
display::TextElementStringBase* m_element;
ElementMenu::slot_type m_slotFocus;
ElementMenu::slot_type m_slotSelect;
};
inline void
ElementMenu::focus_entry(size_type idx) {
if (idx >= size())
return;
if (m_focus)
base_type::operator[](idx)->m_element->set_attributes(display::Attributes::a_reverse);
base_type::operator[](idx).m_element->set_attributes(display::Attributes::a_reverse);
else
base_type::operator[](idx)->m_element->set_attributes(display::Attributes::a_bold);
base_type::operator[](idx).m_element->set_attributes(display::Attributes::a_bold);
}
inline void
@@ -71,7 +64,7 @@ ElementMenu::unfocus_entry(size_type idx) {
if (idx >= size())
return;
base_type::operator[](idx)->m_element->set_attributes(display::Attributes::a_normal);
base_type::operator[](idx).m_element->set_attributes(display::Attributes::a_normal);
}
ElementMenu::ElementMenu() :
@@ -79,7 +72,7 @@ ElementMenu::ElementMenu() :
m_entry(entry_invalid) {
// Move bindings into a function that defines default bindings.
m_bindings[KEY_LEFT] = sigc::mem_fun(&m_slotExit, &slot_type::operator());
m_bindings[KEY_LEFT] = sigc::mem_fun(&m_slotExit, &slot_type::operator());
m_bindings[KEY_RIGHT] = sigc::mem_fun(this, &ElementMenu::entry_select);
m_bindings[KEY_UP] = m_bindings['P' - '@'] = sigc::mem_fun(this, &ElementMenu::entry_prev);
@@ -122,7 +115,7 @@ ElementMenu::disable() {
void
ElementMenu::push_back(const char* name, const slot_type& slotSelect, const slot_type& slotFocus) {
entry_type* entry = new entry_type;
iterator entry = base_type::insert(end(), value_type());
entry->m_element = new display::TextElementCString(name);
entry->m_slotSelect = slotSelect;
@@ -131,8 +124,6 @@ ElementMenu::push_back(const char* name, const slot_type& slotSelect, const slot
m_window->push_back(NULL);
m_window->push_back(entry->m_element);
base_type::push_back(entry);
// For the moment, don't bother doing anything if the window is
// already active.
m_window->mark_dirty();
@@ -149,7 +140,7 @@ ElementMenu::entry_next() {
m_entry = 0;
focus_entry(m_entry);
base_type::operator[](m_entry)->m_slotFocus();
base_type::operator[](m_entry).m_slotFocus();
m_window->mark_dirty();
}
@@ -165,7 +156,7 @@ ElementMenu::entry_prev() {
m_entry = size() - 1;
focus_entry(m_entry);
base_type::operator[](m_entry)->m_slotFocus();
base_type::operator[](m_entry).m_slotFocus();
m_window->mark_dirty();
}
@@ -175,7 +166,7 @@ ElementMenu::entry_select() {
if (m_entry >= size())
return;
base_type::operator[](m_entry)->m_slotSelect();
base_type::operator[](m_entry).m_slotSelect();
m_window->mark_dirty();
}
@@ -190,7 +181,7 @@ ElementMenu::set_entry(size_type idx, bool triggerSlot) {
focus_entry(m_entry);
if (triggerSlot)
base_type::operator[](m_entry)->m_slotFocus();
base_type::operator[](m_entry).m_slotFocus();
m_window->mark_dirty();
}
+10 -5
View File
@@ -45,17 +45,22 @@
namespace display {
class WindowText;
class TextElementStringBase;
}
namespace ui {
struct ElementMenuEntry;
struct ElementMenuEntry {
display::TextElementStringBase* m_element;
class ElementMenu : public ElementBase, public std::vector<ElementMenuEntry*> {
sigc::slot0<void> m_slotFocus;
sigc::slot0<void> m_slotSelect;
};
class ElementMenu : public ElementBase, public std::vector<ElementMenuEntry> {
public:
typedef ElementMenuEntry entry_type;
typedef std::vector<entry_type*> base_type;
typedef sigc::slot0<void> slot_type;
typedef std::vector<ElementMenuEntry> base_type;
typedef sigc::slot0<void> slot_type;
typedef display::WindowText WindowText;