[DEV] correction some internal memory leek
This commit is contained in:
parent
2157099f0a
commit
9b21e5c769
@ -72,12 +72,13 @@ void appl::BufferManager::setBufferSelected(ewol::object::Shared<appl::Buffer> _
|
||||
sendMultiCast(appl::MsgSelectChange, "");
|
||||
}
|
||||
|
||||
void appl::BufferManager::onObjectRemove(const ewol::object::Shared<ewol::Object>& _removeObject) {
|
||||
if (m_bufferSelected == _removeObject) {
|
||||
void appl::BufferManager::onObjectRemove(const ewol::object::Shared<ewol::Object>& _object) {
|
||||
ewol::Resource::onObjectRemove(_object);
|
||||
if (m_bufferSelected == _object) {
|
||||
setBufferSelected(NULL);
|
||||
}
|
||||
for (auto it(m_list.begin()); it!=m_list.end(); ++it) {
|
||||
if (*it != _removeObject) {
|
||||
if (*it != _object) {
|
||||
continue;
|
||||
}
|
||||
m_list.erase(it);
|
||||
|
@ -218,18 +218,21 @@ void BufferView::onReceiveMessage(const ewol::object::Message& _msg) {
|
||||
}
|
||||
}
|
||||
|
||||
void BufferView::onObjectRemove(const ewol::object::Shared<ewol::Object>& _removeObject) {
|
||||
ewol::widget::List::onObjectRemove(_removeObject);
|
||||
for (int32_t iii=0; iii<m_list.size(); iii++) {
|
||||
if (m_list[iii] == NULL) {
|
||||
continue;
|
||||
void BufferView::onObjectRemove(const ewol::object::Shared<ewol::Object>& _object) {
|
||||
ewol::widget::List::onObjectRemove(_object);
|
||||
auto it(m_list.begin());
|
||||
while (it != m_list.end()) {
|
||||
if ( *it != nullptr
|
||||
&& (*it)->m_buffer == _object) {
|
||||
m_list.erase(it);
|
||||
markToRedraw();
|
||||
it = m_list.begin();
|
||||
} else {
|
||||
++it;
|
||||
}
|
||||
if (m_list[iii]->m_buffer != _removeObject) {
|
||||
continue;
|
||||
}
|
||||
m_list.erase(m_list.begin()+iii);
|
||||
markToRedraw();
|
||||
return;
|
||||
}
|
||||
if (m_bufferManager == _object) {
|
||||
m_bufferManager.reset();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -54,7 +54,7 @@ class BufferView : public ewol::widget::List {
|
||||
~BufferView();
|
||||
// Derived function
|
||||
virtual void onReceiveMessage(const ewol::object::Message& _msg);
|
||||
virtual void onObjectRemove(const ewol::object::Shared<ewol::Object>& _removeObject);
|
||||
virtual void onObjectRemove(const ewol::object::Shared<ewol::Object>& _object);
|
||||
private:
|
||||
bool m_openOrderMode; //!< true if the order is the opening order mode, otherwise, Alphabetic order
|
||||
protected:
|
||||
|
@ -133,18 +133,21 @@ MainWindows::MainWindows() {
|
||||
m_bufferManager = appl::BufferManager::keep();
|
||||
|
||||
mySizerVert = ewol::object::makeShared(new ewol::widget::Sizer(ewol::widget::Sizer::modeVert));
|
||||
mySizerVert->setName("plop 1111111");
|
||||
setSubWidget(mySizerVert);
|
||||
|
||||
mySizerHori = ewol::object::makeShared(new ewol::widget::Sizer(ewol::widget::Sizer::modeHori));
|
||||
mySizerHori->setName("plop 222222222");
|
||||
mySizerVert->subWidgetAdd(mySizerHori);
|
||||
myBufferView = ewol::object::makeShared(new BufferView());
|
||||
myBufferView->setName("plop 3333333");
|
||||
myBufferView->setExpand(bvec2(false,true));
|
||||
myBufferView->setFill(bvec2(true,true));
|
||||
mySizerHori->subWidgetAdd(myBufferView);
|
||||
|
||||
mySizerVert2 = ewol::object::makeShared(new ewol::widget::Sizer(ewol::widget::Sizer::modeVert));
|
||||
mySizerHori->subWidgetAdd(mySizerVert2);
|
||||
|
||||
mySizerVert2->setName("plop 4444444");
|
||||
// main buffer Area :
|
||||
#if defined(__TARGET_OS__Android)
|
||||
myTextView = ewol::object::makeShared(new appl::TextViewer("FreeMono;DejaVuSansMono;FreeSerif", 16));
|
||||
@ -166,6 +169,7 @@ MainWindows::MainWindows() {
|
||||
mySizerVert2->subWidgetAdd(mySearch);
|
||||
|
||||
mySizerHori = ewol::object::makeShared(new ewol::widget::Sizer(ewol::widget::Sizer::modeHori));
|
||||
mySizerHori->setName("plop 555555");
|
||||
mySizerVert->subWidgetAdd(mySizerHori);
|
||||
|
||||
myMenu = ewol::object::makeShared(new ewol::widget::Menu());
|
||||
|
@ -162,15 +162,15 @@ void Search::onReceiveMessage(const ewol::object::Message& _msg) {
|
||||
}
|
||||
}
|
||||
|
||||
void Search::onObjectRemove(const ewol::object::Shared<ewol::Object> _removeObject) {
|
||||
ewol::widget::Composer::onObjectRemove(_removeObject);
|
||||
if (_removeObject == m_searchEntry) {
|
||||
void Search::onObjectRemove(const ewol::object::Shared<ewol::Object> _object) {
|
||||
ewol::widget::Composer::onObjectRemove(_object);
|
||||
if (_object == m_searchEntry) {
|
||||
m_searchEntry.reset();
|
||||
}
|
||||
if (_removeObject == m_replaceEntry) {
|
||||
if (_object == m_replaceEntry) {
|
||||
m_replaceEntry.reset();
|
||||
}
|
||||
if (_removeObject == m_viewerManager) {
|
||||
if (_object == m_viewerManager) {
|
||||
m_viewerManager.reset();
|
||||
}
|
||||
}
|
||||
|
@ -38,6 +38,7 @@ void appl::Highlight::parseRules(exml::Element* _child,
|
||||
appl::Highlight::Highlight(const std::string& _xmlFilename, const std::string& _colorFile) :
|
||||
ewol::Resource(_xmlFilename),
|
||||
m_typeName("") {
|
||||
addObjectType("appl::Highlight");
|
||||
// keep color propertiy file :
|
||||
m_paintingProperties = appl::GlyphPainting::keep(_colorFile);
|
||||
|
||||
|
@ -23,7 +23,7 @@ appl::TextViewerPlugin::TextViewerPlugin() :
|
||||
m_activateOnRemove(false),
|
||||
m_activateOnReceiveMessage(false),
|
||||
m_activateOnCursorMove(false) {
|
||||
|
||||
addObjectType("appl::TextViewerPlugin");
|
||||
}
|
||||
|
||||
appl::TextViewerPlugin::~TextViewerPlugin() {
|
||||
|
@ -17,6 +17,7 @@
|
||||
|
||||
appl::TextPluginAutoIndent::TextPluginAutoIndent() {
|
||||
m_activateOnEventEntry = true;
|
||||
addObjectType("appl::TextPluginAutoIndent");
|
||||
}
|
||||
|
||||
bool appl::TextPluginAutoIndent::onEventEntry(appl::TextViewer& _textDrawer,
|
||||
|
@ -17,6 +17,7 @@
|
||||
|
||||
appl::TextPluginCopy::TextPluginCopy() {
|
||||
m_activateOnReceiveMessage = true;
|
||||
addObjectType("appl::TextPluginCopy");
|
||||
}
|
||||
|
||||
void appl::TextPluginCopy::onPluginEnable(appl::TextViewer& _textDrawer) {
|
||||
|
@ -25,6 +25,7 @@ appl::TextPluginCtags::TextPluginCtags() :
|
||||
m_activateOnReceiveMessage = true;
|
||||
// load buffer manager:
|
||||
m_bufferManager = appl::BufferManager::keep();
|
||||
addObjectType("appl::TextPluginCtags");
|
||||
}
|
||||
appl::TextPluginCtags::~TextPluginCtags() {
|
||||
|
||||
|
@ -20,6 +20,7 @@ namespace appl {
|
||||
public:
|
||||
TextViewerPluginData() {
|
||||
// nothing to do ...
|
||||
addObjectType("appl::TextViewerPluginData");
|
||||
}
|
||||
virtual ~TextViewerPluginData() {
|
||||
for (size_t iii = 0; iii < m_specificData.size() ; ++iii) {
|
||||
@ -115,9 +116,10 @@ namespace appl {
|
||||
return;
|
||||
};
|
||||
public:
|
||||
virtual void onObjectRemove(const ewol::object::Shared<ewol::Object>& _removeObject) {
|
||||
virtual void onObjectRemove(const ewol::object::Shared<ewol::Object>& _object) {
|
||||
appl::TextViewerPlugin::onObjectRemove(_object);
|
||||
for (auto it(m_specificData.begin()); it != m_specificData.end(); ++it) {
|
||||
if (it->first == _removeObject) {
|
||||
if (it->first == _object) {
|
||||
m_specificData.erase(it);
|
||||
it = m_specificData.begin();
|
||||
}
|
||||
|
@ -20,6 +20,7 @@ appl::TextPluginHistory::TextPluginHistory() {
|
||||
m_activateOnWrite = true;
|
||||
m_activateOnReplace = true;
|
||||
m_activateOnRemove = true;
|
||||
addObjectType("appl::TextPluginHistory");
|
||||
}
|
||||
|
||||
void appl::TextPluginHistory::onPluginEnable(appl::TextViewer& _textDrawer) {
|
||||
@ -176,7 +177,8 @@ bool appl::TextPluginHistory::onRemove(appl::TextViewer& _textDrawer,
|
||||
}
|
||||
|
||||
|
||||
void appl::TextPluginHistory::onObjectRemove(const ewol::object::Shared<ewol::Object>& _removeObject) {
|
||||
void appl::TextPluginHistory::onObjectRemove(const ewol::object::Shared<ewol::Object>& _object) {
|
||||
appl::TextViewerPluginData<appl::PluginHistoryData>::onObjectRemove(_object);
|
||||
// TODO : Dependence with buffer removing ...
|
||||
}
|
||||
|
||||
|
@ -67,7 +67,7 @@ namespace appl {
|
||||
void clearRedo(appl::PluginHistoryData& _data);
|
||||
void clearUndo(appl::PluginHistoryData& _data);
|
||||
public:
|
||||
virtual void onObjectRemove(const ewol::object::Shared<ewol::Object>& _removeObject);
|
||||
virtual void onObjectRemove(const ewol::object::Shared<ewol::Object>& _object);
|
||||
};
|
||||
};
|
||||
|
||||
|
@ -19,8 +19,8 @@
|
||||
#undef __class__
|
||||
#define __class__ "textPluginManager"
|
||||
|
||||
static std::vector<ewol::object::Shared<appl::TextViewerPlugin>>& getList() {
|
||||
static std::vector<ewol::object::Shared<appl::TextViewerPlugin>> s_list;
|
||||
static std::list<ewol::object::Owner<appl::TextViewerPlugin>>& getList() {
|
||||
static std::list<ewol::object::Owner<appl::TextViewerPlugin>> s_list;
|
||||
return s_list;
|
||||
}
|
||||
static std::vector<ewol::object::Shared<appl::TextViewerPlugin>>& getListOnEventEntry() {
|
||||
@ -107,31 +107,30 @@ void appl::textPluginManager::addPlugin(const ewol::object::Shared<appl::TextVie
|
||||
}
|
||||
|
||||
void appl::textPluginManager::connect(appl::TextViewer& _widget) {
|
||||
for (int32_t iii=0; iii<getList().size(); ++iii) {
|
||||
if (getList()[iii] == NULL) {
|
||||
for (auto &it : getList()) {
|
||||
if (it == NULL) {
|
||||
continue;
|
||||
}
|
||||
getList()[iii]->onPluginEnable(_widget);
|
||||
it->onPluginEnable(_widget);
|
||||
}
|
||||
}
|
||||
|
||||
void appl::textPluginManager::disconnect(appl::TextViewer& _widget) {
|
||||
for (int32_t iii=0; iii<getList().size(); ++iii) {
|
||||
if (getList()[iii] == NULL) {
|
||||
for (auto &it : getList()) {
|
||||
if (it == NULL) {
|
||||
continue;
|
||||
}
|
||||
getList()[iii]->onPluginDisable(_widget);
|
||||
it->onPluginDisable(_widget);
|
||||
}
|
||||
}
|
||||
|
||||
bool appl::textPluginManager::onEventEntry(appl::TextViewer& _textDrawer,
|
||||
const ewol::event::Entry& _event) {
|
||||
std::vector<ewol::object::Shared<appl::TextViewerPlugin>>& list = getListOnEventEntry();
|
||||
for (int32_t iii=0; iii<list.size(); ++iii) {
|
||||
if (list[iii] == NULL) {
|
||||
for (auto &it : getListOnEventEntry()) {
|
||||
if (it == NULL) {
|
||||
continue;
|
||||
}
|
||||
if (list[iii]->onEventEntry(_textDrawer, _event) == true ) {
|
||||
if (it->onEventEntry(_textDrawer, _event) == true ) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@ -140,12 +139,11 @@ bool appl::textPluginManager::onEventEntry(appl::TextViewer& _textDrawer,
|
||||
|
||||
bool appl::textPluginManager::onEventInput(appl::TextViewer& _textDrawer,
|
||||
const ewol::event::Input& _event) {
|
||||
std::vector<ewol::object::Shared<appl::TextViewerPlugin>>& list = getListOnEventInput();
|
||||
for (int32_t iii=0; iii<list.size(); ++iii) {
|
||||
if (list[iii] == NULL) {
|
||||
for (auto &it : getListOnEventInput()) {
|
||||
if (it == NULL) {
|
||||
continue;
|
||||
}
|
||||
if (list[iii]->onEventInput(_textDrawer, _event) == true ) {
|
||||
if (it->onEventInput(_textDrawer, _event) == true ) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@ -155,12 +153,11 @@ bool appl::textPluginManager::onEventInput(appl::TextViewer& _textDrawer,
|
||||
bool appl::textPluginManager::onWrite(appl::TextViewer& _textDrawer,
|
||||
const appl::Buffer::Iterator& _pos,
|
||||
const std::string& _data) {
|
||||
std::vector<ewol::object::Shared<appl::TextViewerPlugin>>& list = getListOnWrite();
|
||||
for (int32_t iii=0; iii<list.size(); ++iii) {
|
||||
if (list[iii] == NULL) {
|
||||
for (auto &it : getListOnWrite()) {
|
||||
if (it == NULL) {
|
||||
continue;
|
||||
}
|
||||
if (list[iii]->onWrite(_textDrawer, _pos, _data) == true ) {
|
||||
if (it->onWrite(_textDrawer, _pos, _data) == true ) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@ -171,12 +168,11 @@ bool appl::textPluginManager::onReplace(appl::TextViewer& _textDrawer,
|
||||
const appl::Buffer::Iterator& _pos,
|
||||
const std::string& _data,
|
||||
const appl::Buffer::Iterator& _posEnd) {
|
||||
std::vector<ewol::object::Shared<appl::TextViewerPlugin>>& list = getListOnReplace();
|
||||
for (int32_t iii=0; iii<list.size(); ++iii) {
|
||||
if (list[iii] == NULL) {
|
||||
for (auto &it : getListOnReplace()) {
|
||||
if (it == NULL) {
|
||||
continue;
|
||||
}
|
||||
if (list[iii]->onReplace(_textDrawer, _pos, _data, _posEnd) == true ) {
|
||||
if (it->onReplace(_textDrawer, _pos, _data, _posEnd) == true ) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@ -186,12 +182,11 @@ bool appl::textPluginManager::onReplace(appl::TextViewer& _textDrawer,
|
||||
bool appl::textPluginManager::onRemove(appl::TextViewer& _textDrawer,
|
||||
const appl::Buffer::Iterator& _pos,
|
||||
const appl::Buffer::Iterator& _posEnd) {
|
||||
std::vector<ewol::object::Shared<appl::TextViewerPlugin>>& list = getListOnRemove();
|
||||
for (int32_t iii=0; iii<list.size(); ++iii) {
|
||||
if (list[iii] == NULL) {
|
||||
for (auto &it : getListOnRemove()) {
|
||||
if (it == NULL) {
|
||||
continue;
|
||||
}
|
||||
if (list[iii]->onRemove(_textDrawer, _pos, _posEnd) == true ) {
|
||||
if (it->onRemove(_textDrawer, _pos, _posEnd) == true ) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@ -200,12 +195,11 @@ bool appl::textPluginManager::onRemove(appl::TextViewer& _textDrawer,
|
||||
|
||||
bool appl::textPluginManager::onReceiveMessage(appl::TextViewer& _textDrawer,
|
||||
const ewol::object::Message& _msg) {
|
||||
std::vector<ewol::object::Shared<appl::TextViewerPlugin>>& list = getListOnReceiveMessage();
|
||||
for (int32_t iii=0; iii<list.size(); ++iii) {
|
||||
if (list[iii] == NULL) {
|
||||
for (auto &it : getListOnReceiveMessage()) {
|
||||
if (it == NULL) {
|
||||
continue;
|
||||
}
|
||||
if (list[iii]->onReceiveMessage(_textDrawer, _msg) == true ) {
|
||||
if (it->onReceiveMessage(_textDrawer, _msg) == true ) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@ -214,12 +208,11 @@ bool appl::textPluginManager::onReceiveMessage(appl::TextViewer& _textDrawer,
|
||||
|
||||
bool appl::textPluginManager::onCursorMove(appl::TextViewer& _textDrawer,
|
||||
const appl::Buffer::Iterator& _pos) {
|
||||
std::vector<ewol::object::Shared<appl::TextViewerPlugin>>& list = getListOnCursorMove();
|
||||
for (int32_t iii=0; iii<list.size(); ++iii) {
|
||||
if (list[iii] == NULL) {
|
||||
for (auto &it : getListOnCursorMove()) {
|
||||
if (it == NULL) {
|
||||
continue;
|
||||
}
|
||||
if (list[iii]->onCursorMove(_textDrawer, _pos) == true ) {
|
||||
if (it->onCursorMove(_textDrawer, _pos) == true ) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -16,6 +16,7 @@
|
||||
|
||||
appl::TextPluginMultiLineTab::TextPluginMultiLineTab() {
|
||||
m_activateOnEventEntry = true;
|
||||
addObjectType("appl::TextPluginMultiLineTab");
|
||||
}
|
||||
|
||||
bool appl::TextPluginMultiLineTab::onEventEntry(appl::TextViewer& _textDrawer,
|
||||
|
@ -17,6 +17,7 @@
|
||||
|
||||
appl::TextPluginRmLine::TextPluginRmLine() {
|
||||
m_activateOnReceiveMessage = true;
|
||||
addObjectType("appl::TextPluginRmLine");
|
||||
}
|
||||
|
||||
void appl::TextPluginRmLine::onPluginEnable(appl::TextViewer& _textDrawer) {
|
||||
|
@ -17,6 +17,7 @@
|
||||
|
||||
appl::TextPluginSelectAll::TextPluginSelectAll() {
|
||||
m_activateOnReceiveMessage = true;
|
||||
addObjectType("appl::TextPluginSelectAll");
|
||||
}
|
||||
|
||||
static const char* eventSelectAll = "plugin-select-all";
|
||||
|
Loading…
x
Reference in New Issue
Block a user