* ./hurricane/src/hviewer :
- Bug: in CellViewer::setCell(), do not try to get the name of the cell if it's a NULL pointer... Solve the cyclop "empty cell" coredump problem. - New feature : dbo_destroy<> a shared_ptr<> that calls the destroy method of an object, specially tailored for DBo. Application in Cyclop.
This commit is contained in:
parent
78be633226
commit
ecc9c5402f
|
@ -33,6 +33,7 @@
|
||||||
#include <cstdio>
|
#include <cstdio>
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
|
|
||||||
|
#include <tr1/memory>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <list>
|
#include <list>
|
||||||
#include <set>
|
#include <set>
|
||||||
|
@ -83,6 +84,27 @@ namespace Hurricane {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// x-------------------------------------------------------------x
|
||||||
|
// | shared_ptr<> support for DBo |
|
||||||
|
// x-------------------------------------------------------------x
|
||||||
|
|
||||||
|
|
||||||
|
template<typename DboType>
|
||||||
|
class DboDestroy {
|
||||||
|
public:
|
||||||
|
inline void operator() ( DboType* dbo ) { dbo->destroy(); }
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
template<typename DboType>
|
||||||
|
class dbo_ptr : public tr1::shared_ptr<DboType> {
|
||||||
|
public:
|
||||||
|
dbo_ptr ( DboType* dbo ) : tr1::shared_ptr<DboType>(dbo,DboDestroy<DboType>()) { }
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// x-------------------------------------------------------------x
|
// x-------------------------------------------------------------x
|
||||||
// | Miscellaneous Utilites |
|
// | Miscellaneous Utilites |
|
||||||
// x-------------------------------------------------------------x
|
// x-------------------------------------------------------------x
|
||||||
|
|
|
@ -331,8 +331,10 @@ namespace Hurricane {
|
||||||
|
|
||||||
void CellViewer::setCell ( Cell* cell )
|
void CellViewer::setCell ( Cell* cell )
|
||||||
{
|
{
|
||||||
|
Name cellName = (cell) ? cell->getName() : "empty";
|
||||||
|
|
||||||
list< shared_ptr<CellWidget::State> >::iterator istate
|
list< shared_ptr<CellWidget::State> >::iterator istate
|
||||||
= find_if ( _cellHistory.begin(), _cellHistory.end(), CellWidget::FindStateName(cell->getName()) );
|
= find_if ( _cellHistory.begin(), _cellHistory.end(), CellWidget::FindStateName(cellName) );
|
||||||
|
|
||||||
if ( istate != _cellHistory.end() ) {
|
if ( istate != _cellHistory.end() ) {
|
||||||
emit stateChanged ( *istate );
|
emit stateChanged ( *istate );
|
||||||
|
|
Loading…
Reference in New Issue