fix crash that deprecation is included in NANA_IGNORE_CONF

it crashs when build with CMake
This commit is contained in:
Jinhao 2016-06-25 04:55:06 +08:00
parent 484b84189f
commit d701650cd5
3 changed files with 15 additions and 43 deletions

View File

@ -25,7 +25,11 @@
#include "c++defines.hpp" #include "c++defines.hpp"
//The basic configurations are ignored when NANA_IGNORE_CONF is defined. //This marco is defined since 1.4 and until 1.5 for deprecating frame widget.
//This marco and class frame will be removed in version 1.5
#define WIDGET_FRAME_DEPRECATED
//The following basic configurations are ignored when NANA_IGNORE_CONF is defined.
//The NANA_IGNORE_CONF may be specified by CMake generated makefile. //The NANA_IGNORE_CONF may be specified by CMake generated makefile.
#ifndef NANA_IGNORE_CONF #ifndef NANA_IGNORE_CONF
@ -93,10 +97,6 @@
#endif #endif
#endif #endif
//This marco is defined since 1.4 and until 1.5 for deprecating frame widget.
//This marco and class frame will be removed in version 1.5
#define WIDGET_FRAME_DEPRECATED
/////////////////// ///////////////////
// Support for NANA_AUTOMATIC_GUI_TESTING // Support for NANA_AUTOMATIC_GUI_TESTING
// Will cause the program to self-test the GUI. A default automatic GUI test // Will cause the program to self-test the GUI. A default automatic GUI test

View File

@ -212,18 +212,11 @@ namespace detail
struct attr_root_tag struct attr_root_tag
{ {
attr_root_tag(const attr_root_tag&) = delete;
attr_root_tag(attr_root_tag&&) = delete;
#ifndef WIDGET_FRAME_DEPRECATED #ifndef WIDGET_FRAME_DEPRECATED
container frames; ///< initialization is null, it will be created while creating a frame widget. Refer to WindowManager::create_frame container frames; ///< initialization is null, it will be created while creating a frame widget. Refer to WindowManager::create_frame
#endif #endif
//Following p_xxx pointers are used for debugging container tabstop;
container * p_tabstop; std::vector<edge_nimbus_action> effects_edge_nimbus;
std::vector<edge_nimbus_action> * p_effects;
std::function<void()> * p_draw_through;
container& tabstop;
std::vector<edge_nimbus_action>& effects_edge_nimbus;
basic_window* focus{nullptr}; basic_window* focus{nullptr};
basic_window* menubar{nullptr}; basic_window* menubar{nullptr};
bool ime_enabled{false}; bool ime_enabled{false};
@ -233,18 +226,7 @@ namespace detail
cursor state_cursor{nana::cursor::arrow}; cursor state_cursor{nana::cursor::arrow};
basic_window* state_cursor_window{ nullptr }; basic_window* state_cursor_window{ nullptr };
std::function<void()>& draw_through; ///< A draw through renderer for root widgets. std::function<void()> draw_through; ///< A draw through renderer for root widgets.
attr_root_tag():
p_tabstop(new container),
p_effects(new std::vector<edge_nimbus_action>),
p_draw_through(new std::function<void()>),
tabstop(*p_tabstop),
effects_edge_nimbus(*p_effects),
draw_through(*p_draw_through)
{}
~attr_root_tag();
}; };
const category::flags category; const category::flags category;
@ -262,7 +244,6 @@ namespace detail
}attribute; }attribute;
other_tag(category::flags); other_tag(category::flags);
~other_tag();
}other; }other;
native_window_type root; ///< root Window handle native_window_type root; ///< root Window handle

View File

@ -13,8 +13,6 @@
#include <nana/gui/detail/basic_window.hpp> #include <nana/gui/detail/basic_window.hpp>
#include <nana/gui/detail/native_window_interface.hpp> #include <nana/gui/detail/native_window_interface.hpp>
#include <iostream> //debug travis
namespace nana namespace nana
{ {
namespace detail namespace detail
@ -209,34 +207,33 @@ namespace nana
//end class caret //end class caret
//struct basic_window //struct basic_window
basic_window::other_tag::attr_root_tag::~attr_root_tag()
{
std::cout<<"~attr_root_tag "<<this<<std::endl;
}
//struct basic_window::other_tag //struct basic_window::other_tag
basic_window::other_tag::other_tag(category::flags categ) basic_window::other_tag::other_tag(category::flags categ)
: category(categ), active_window(nullptr), upd_state(update_state::none) : category(categ), active_window(nullptr), upd_state(update_state::none)
{ {
#ifndef WIDGET_FRAME_DEPRECATED
switch(categ) switch(categ)
{ {
case category::flags::root: case category::flags::root:
attribute.root = new attr_root_tag; attribute.root = new attr_root_tag;
std::cout<<"basic_window: create attr root "<<attribute.root<<std::endl;
break; break;
#ifndef WIDGET_FRAME_DEPRECATED
case category::flags::frame: case category::flags::frame:
attribute.frame = new attr_frame_tag; attribute.frame = new attr_frame_tag;
break; break;
#endif
default: default:
attribute.root = nullptr; attribute.root = nullptr;
} }
#else
if (category::flags::root == categ)
attribute.root = new attr_root_tag;
else
attribute.root = nullptr;
#endif
} }
basic_window::other_tag::~other_tag() basic_window::other_tag::~other_tag()
{ {
#ifndef WIDGET_FRAME_DEPRECATED #ifndef WIDGET_FRAME_DEPRECATED
std::cout<<"~other_tag "<<this<<std::endl;
switch(category) switch(category)
{ {
case category::flags::root: case category::flags::root:
@ -248,14 +245,8 @@ namespace nana
default: break; default: break;
} }
#endif #endif
if (category::flags::root == category) if (category::flags::root == category)
{
std::cout<<"basic_window: delete attr root "<<attribute.root<<std::endl;
std::cout<<"basic_window: root.effects size "<<attribute.root->effects_edge_nimbus.size()<<std::endl;
delete attribute.root; delete attribute.root;
std::cout<<" delete successfully"<<std::endl;
}
} }
//end struct basic_window::other_tag //end struct basic_window::other_tag