mirror of
https://github.com/cjcliffe/CubicSDR.git
synced 2024-09-20 12:26:57 -04:00
Bookmarks: a BookmarkEntry owns its DataNode, so free it in destructor
This commit is contained in:
parent
9726f0eec6
commit
294713945a
@ -203,6 +203,7 @@ void BookmarkMgr::addBookmark(std::string group, DemodulatorInstance *demod) {
|
|||||||
|
|
||||||
BookmarkEntryPtr be = demodToBookmarkEntry(demod);
|
BookmarkEntryPtr be = demodToBookmarkEntry(demod);
|
||||||
|
|
||||||
|
//copy settings of demod into be->node
|
||||||
wxGetApp().getDemodMgr().saveInstance(be->node, demod);
|
wxGetApp().getDemodMgr().saveInstance(be->node, demod);
|
||||||
|
|
||||||
bmData[group].push_back(be);
|
bmData[group].push_back(be);
|
||||||
@ -483,6 +484,8 @@ BookmarkEntryPtr BookmarkMgr::demodToBookmarkEntry(DemodulatorInstance *demod) {
|
|||||||
be->label = demod->getDemodulatorUserLabel();
|
be->label = demod->getDemodulatorUserLabel();
|
||||||
be->frequency = demod->getFrequency();
|
be->frequency = demod->getFrequency();
|
||||||
|
|
||||||
|
//fine to do so here, so long nobody overrides be->node, DataNode will be
|
||||||
|
//deleted at last BookmarkEntryPtr be ref.
|
||||||
be->node = new DataNode;
|
be->node = new DataNode;
|
||||||
wxGetApp().getDemodMgr().saveInstance(be->node, demod);
|
wxGetApp().getDemodMgr().saveInstance(be->node, demod);
|
||||||
|
|
||||||
@ -506,6 +509,9 @@ BookmarkEntryPtr BookmarkMgr::nodeToBookmark(const char *name_in, DataNode *node
|
|||||||
|
|
||||||
node->rewindAll();
|
node->rewindAll();
|
||||||
|
|
||||||
|
//fine to do so here, so long nobody overrides be->node, DataNode will be
|
||||||
|
//deleted at last BookmarkEntryPtr be ref.
|
||||||
|
//copy data from *node.
|
||||||
be->node = new DataNode("node",*node);
|
be->node = new DataNode("node",*node);
|
||||||
|
|
||||||
return be;
|
return be;
|
||||||
|
@ -8,10 +8,10 @@
|
|||||||
#include <vector>
|
#include <vector>
|
||||||
#include <set>
|
#include <set>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
#include "DataTree.h"
|
||||||
|
|
||||||
#include "DemodulatorInstance.h"
|
#include "DemodulatorInstance.h"
|
||||||
|
|
||||||
class DataNode;
|
|
||||||
|
|
||||||
class BookmarkEntry {
|
class BookmarkEntry {
|
||||||
public:
|
public:
|
||||||
@ -25,6 +25,11 @@ public:
|
|||||||
int bandwidth;
|
int bandwidth;
|
||||||
|
|
||||||
DataNode *node;
|
DataNode *node;
|
||||||
|
|
||||||
|
virtual ~BookmarkEntry() {
|
||||||
|
//free node
|
||||||
|
delete node;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -1584,27 +1584,16 @@ void BookmarkView::onClearSearch( wxCommandEvent& /* event */ ) {
|
|||||||
|
|
||||||
void BookmarkView::loadDefaultRanges() {
|
void BookmarkView::loadDefaultRanges() {
|
||||||
|
|
||||||
BookmarkRangeEntryPtr band_160meters(new BookmarkRangeEntry(L"160 Meters", 1900000, 1800000, 2000000));
|
wxGetApp().getBookmarkMgr().addRange(std::make_shared<BookmarkRangeEntry>(L"160 Meters", 1900000, 1800000, 2000000));
|
||||||
BookmarkRangeEntryPtr band_80meters(new BookmarkRangeEntry(L"80 Meters", 3750000, 3500000, 4000000));
|
wxGetApp().getBookmarkMgr().addRange(std::make_shared<BookmarkRangeEntry>(L"80 Meters", 3750000, 3500000, 4000000));
|
||||||
BookmarkRangeEntryPtr band_60meters(new BookmarkRangeEntry(L"60 Meters", 5368500, 5332000, 5405000));
|
wxGetApp().getBookmarkMgr().addRange(std::make_shared<BookmarkRangeEntry>(L"60 Meters", 5368500, 5332000, 5405000));
|
||||||
BookmarkRangeEntryPtr band_40meters(new BookmarkRangeEntry(L"40 Meters", 7150000, 7000000, 7300000));
|
wxGetApp().getBookmarkMgr().addRange(std::make_shared<BookmarkRangeEntry>(L"40 Meters", 7150000, 7000000, 7300000));
|
||||||
BookmarkRangeEntryPtr band_30meters(new BookmarkRangeEntry(L"30 Meters", 10125000, 10100000, 10150000));
|
wxGetApp().getBookmarkMgr().addRange(std::make_shared<BookmarkRangeEntry>(L"30 Meters", 10125000, 10100000, 10150000));
|
||||||
BookmarkRangeEntryPtr band_20meters(new BookmarkRangeEntry(L"20 Meters", 14175000, 14000000, 14350000));
|
wxGetApp().getBookmarkMgr().addRange(std::make_shared<BookmarkRangeEntry>(L"20 Meters", 14175000, 14000000, 14350000));
|
||||||
BookmarkRangeEntryPtr band_17meters(new BookmarkRangeEntry(L"17 Meters", 18068180, 17044180, 19092180));
|
wxGetApp().getBookmarkMgr().addRange(std::make_shared<BookmarkRangeEntry>(L"17 Meters", 18068180, 17044180, 19092180));
|
||||||
BookmarkRangeEntryPtr band_15meters(new BookmarkRangeEntry(L"15 Meters", 21225000, 21000000, 21450000));
|
wxGetApp().getBookmarkMgr().addRange(std::make_shared<BookmarkRangeEntry>(L"15 Meters", 21225000, 21000000, 21450000));
|
||||||
BookmarkRangeEntryPtr band_12meters(new BookmarkRangeEntry(L"12 Meters", 24940000, 24890000, 24990000));
|
wxGetApp().getBookmarkMgr().addRange(std::make_shared<BookmarkRangeEntry>(L"12 Meters", 24940000, 24890000, 24990000));
|
||||||
BookmarkRangeEntryPtr band_10meters(new BookmarkRangeEntry(L"10 Meters", 28850000, 28000000, 29700000));
|
wxGetApp().getBookmarkMgr().addRange(std::make_shared<BookmarkRangeEntry>(L"10 Meters", 28850000, 28000000, 29700000));
|
||||||
|
|
||||||
wxGetApp().getBookmarkMgr().addRange(band_160meters);
|
|
||||||
wxGetApp().getBookmarkMgr().addRange(band_80meters);
|
|
||||||
wxGetApp().getBookmarkMgr().addRange(band_60meters);
|
|
||||||
wxGetApp().getBookmarkMgr().addRange(band_40meters);
|
|
||||||
wxGetApp().getBookmarkMgr().addRange(band_30meters);
|
|
||||||
wxGetApp().getBookmarkMgr().addRange(band_20meters);
|
|
||||||
wxGetApp().getBookmarkMgr().addRange(band_17meters);
|
|
||||||
wxGetApp().getBookmarkMgr().addRange(band_15meters);
|
|
||||||
wxGetApp().getBookmarkMgr().addRange(band_12meters);
|
|
||||||
wxGetApp().getBookmarkMgr().addRange(band_10meters);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user