修正延迟释放的错误
This commit is contained in:
parent
1ef520d6e8
commit
17335aca05
|
@ -17,11 +17,12 @@
|
|||
using namespace split_window;
|
||||
using namespace split_frame;
|
||||
|
||||
SplitWindow::SplitWindow(QWidget *parent) : QMainWindow(parent), accept_port(new accept_panel::AcceptPanel(this, this)), view_root(nullptr) {
|
||||
SplitWindow::SplitWindow(QWidget *parent)
|
||||
: QMainWindow(parent), active(true), accept_port(new accept_panel::AcceptPanel(this, this)), view_root(nullptr) {
|
||||
accept_port->setVisible(false);
|
||||
}
|
||||
|
||||
SplitWindow::~SplitWindow() {}
|
||||
SplitWindow::~SplitWindow() {this->active = false;}
|
||||
|
||||
void SplitWindow::tempShow(split_frame::DockType t, split_frame::ViewBase *target)
|
||||
{
|
||||
|
@ -97,13 +98,13 @@ void SplitWindow::removeListener(split_frame::FreedomViewsListener *lsn)
|
|||
|
||||
void SplitWindow::appendPresentView(split_frame::ViewBase *inst)
|
||||
{
|
||||
if(inst)
|
||||
if(this->active && inst)
|
||||
this->presents_store[inst->hashCode()] = inst;
|
||||
}
|
||||
|
||||
void SplitWindow::removePresentView(split_frame::ViewBase *inst)
|
||||
{
|
||||
if(inst)
|
||||
if(this->active && inst)
|
||||
this->presents_store.remove(inst->hashCode());
|
||||
}
|
||||
|
||||
|
|
|
@ -18,6 +18,7 @@ namespace split_window {
|
|||
typedef float width;
|
||||
|
||||
private:
|
||||
bool active = false;
|
||||
QList<split_frame::FreedomViewsListener*> listener_list;
|
||||
|
||||
QHash<qulonglong, split_frame::ViewBase*> presents_store;
|
||||
|
|
|
@ -18,15 +18,15 @@
|
|||
int main(int argc, char *argv[]) {
|
||||
QApplication a(argc, argv);
|
||||
|
||||
auto w = new split_window::SplitWindow;
|
||||
auto spb = new split_panel::SplitPanel(w, split_frame::SplitType::SPLIT_H_LFIRST);
|
||||
auto bview = new dock_panel::DockableView(w, new QWidget, true);
|
||||
auto dview = new dock_panel::DockableView(w, new QWidget, true);
|
||||
split_window::SplitWindow w;
|
||||
auto spb = new split_panel::SplitPanel(&w, split_frame::SplitType::SPLIT_H_LFIRST);
|
||||
auto bview = new dock_panel::DockableView(&w, new QWidget, true);
|
||||
auto dview = new dock_panel::DockableView(&w, new QWidget, true);
|
||||
spb->initViews(bview, dview);
|
||||
|
||||
w->setPresentTarget(spb);
|
||||
a.installEventFilter(w);
|
||||
w.setPresentTarget(spb);
|
||||
a.installEventFilter(&w);
|
||||
|
||||
w->show();
|
||||
w.show();
|
||||
return a.exec();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue