From 3118c9419707f82444f459dc4f59fc1fea85329a Mon Sep 17 00:00:00 2001 From: caremoli Date: Thu, 1 Jul 2010 14:29:02 +0000 Subject: [PATCH] CCAR: restore calls to begininsertrow, etc. --- src/SUIT/SUIT_TreeModel.cxx | 12 ++--- src/Session/SALOME_Session_Server.cxx | 64 +++++++++++++++++++++++++++ 2 files changed, 71 insertions(+), 5 deletions(-) diff --git a/src/SUIT/SUIT_TreeModel.cxx b/src/SUIT/SUIT_TreeModel.cxx index 69b9cfa95..8291e6afa 100755 --- a/src/SUIT/SUIT_TreeModel.cxx +++ b/src/SUIT/SUIT_TreeModel.cxx @@ -909,6 +909,7 @@ QModelIndex SUIT_TreeModel::index( int row, int column, */ QModelIndex SUIT_TreeModel::parent( const QModelIndex& index ) const { + //std::cerr << "SUIT_TreeModel::parent " << index.row() << std::endl; if ( !index.isValid() ) return QModelIndex(); @@ -1120,11 +1121,12 @@ void SUIT_TreeModel::updateTree( SUIT_DataObject* obj ) else if ( obj->root() != root() ) return; - emit layoutAboutToBeChanged(); synchronize( obj, treeItem( obj ), SUIT_TreeModel::TreeSync( this ) ); + + emit layoutAboutToBeChanged(); emit layoutChanged(); emit modelUpdated(); } @@ -1228,11 +1230,11 @@ SUIT_TreeModel::TreeItem* SUIT_TreeModel::createItem( SUIT_DataObject* obj, int row = afterObj ? afterObj->position() + 1 : 0; //std::cerr << " SUIT_TreeModel::createItem " << row << ":" << afterObj << std::endl; - //beginInsertRows( parentIdx, row, row ); + beginInsertRows( parentIdx, row, row ); myItems[ obj ] = new TreeItem( obj, parent, after ); - //endInsertRows(); + endInsertRows(); //obj->setModified(false); @@ -1311,7 +1313,7 @@ void SUIT_TreeModel::removeItem( SUIT_TreeModel::TreeItem* item ) QModelIndex parentIdx = index( parentObj, 0 ); int row = item->position(); - //beginRemoveRows( parentIdx, row, row ); + beginRemoveRows( parentIdx, row, row ); myItems.remove( obj ); if ( obj == root() ) @@ -1321,7 +1323,7 @@ void SUIT_TreeModel::removeItem( SUIT_TreeModel::TreeItem* item ) delete item; - //endRemoveRows(); + endRemoveRows(); } void SUIT_TreeModel::onUpdated( SUIT_DataObject* object) diff --git a/src/Session/SALOME_Session_Server.cxx b/src/Session/SALOME_Session_Server.cxx index 40e5a7ad0..7e3be00c3 100755 --- a/src/Session/SALOME_Session_Server.cxx +++ b/src/Session/SALOME_Session_Server.cxx @@ -68,6 +68,61 @@ #include #include #include +#ifndef WIN32 +#include +#endif + +#include +#include +#include +#include + +void AttachDebugger(); +void Handler(int); + +typedef void (*sighandler_t)(int); +sighandler_t setsig(int sig, sighandler_t handler) +{ + struct sigaction context, ocontext; + context.sa_handler = handler; + sigemptyset(&context.sa_mask); + context.sa_flags = 0; + if (sigaction(sig, &context, &ocontext) == -1) + return SIG_ERR; + return ocontext.sa_handler; +} + +void AttachDebugger() +{ + if(getenv ("DEBUGGER")) + { + std::stringstream exec; + exec << "$DEBUGGER SALOME_Session_Server " << getpid() << "&"; + std::cerr << exec.str() << std::endl; + system(exec.str().c_str()); + while(1); + } +} + +void Handler(int theSigId) +{ + std::cerr << "SIGSEGV: " << std::endl; + AttachDebugger(); + //to exit or not to exit + exit(1); +} +void terminateHandler(void) +{ + std::cerr << "Terminate: not managed exception !" << std::endl; + AttachDebugger(); +} + +void unexpectedHandler(void) +{ + std::cerr << "Unexpected: unexpected exception !" << std::endl; + AttachDebugger(); +} + #include @@ -346,6 +401,15 @@ void shutdownServers( SALOME_NamingService* theNS ) // ---------------------------- MAIN ----------------------- int main( int argc, char **argv ) { + + if(getenv ("DEBUGGER")) + { + setsig(SIGSEGV,&Handler); + setsig(SIGBUS,&Handler); + set_terminate(&terminateHandler); + set_unexpected(&unexpectedHandler); + } + // Install Qt debug messages handler qInstallMsgHandler( MessageOutput ); -- 2.39.2