From: rnv Date: Thu, 26 Apr 2018 13:43:10 +0000 (+0300) Subject: Fix for '23531: [CEA] Crash on switching to HEXABLOC from any module without Objects... X-Git-Tag: V8_5_0rc2^2~1 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=ebb68bd6a487a6131bd55ee2b565ebe56e583c5b;p=modules%2Fhexablock.git Fix for '23531: [CEA] Crash on switching to HEXABLOC from any module without Objects Browser' issue --- diff --git a/src/HEXABLOCKGUI/HEXABLOCKGUI.cxx b/src/HEXABLOCKGUI/HEXABLOCKGUI.cxx index cff4a46..78aee18 100755 --- a/src/HEXABLOCKGUI/HEXABLOCKGUI.cxx +++ b/src/HEXABLOCKGUI/HEXABLOCKGUI.cxx @@ -285,8 +285,10 @@ bool HEXABLOCKGUI::activateModule( SUIT_Study* theStudy ) connect( getApp()->desktop(), SIGNAL( windowActivated( SUIT_ViewWindow* ) ), this, SLOT(onWindowActivated( SUIT_ViewWindow* )), Qt::UniqueConnection ); - connect( getApp()->objectBrowser()->treeView(),SIGNAL( clicked(const QModelIndex&) ), - this, SLOT( onObjectBrowserClick(const QModelIndex&) ), Qt::UniqueConnection ); + if ( getApp()->objectBrowser() ) { + connect( getApp()->objectBrowser()->treeView(),SIGNAL( clicked(const QModelIndex&) ), + this, SLOT( onObjectBrowserClick(const QModelIndex&) ), Qt::UniqueConnection ); + } LightApp_SelectionMgr* sm = getApp()->selectionMgr(); @@ -1019,24 +1021,32 @@ void HEXABLOCKGUI::createAndFillDockWidget() _meshTreeView->show(); // QDockWidget *_dwObjectBrowser = 0; - QWidget* wid = getApp()->objectBrowser()->treeView(); - QWidget *w = wid->parentWidget(); - while ( w && !_dwObjectBrowser ) { - _dwObjectBrowser = ::qobject_cast( w ); - w = w->parentWidget(); + QWidget* wid = 0; + if ( getApp()->objectBrowser() ) + wid = getApp()->objectBrowser()->treeView(); + while ( wid && !_dwObjectBrowser ) { + _dwObjectBrowser = ::qobject_cast( wid ); + wid = wid->parentWidget(); + } + + if ( _dwObjectBrowser ) { + _dwObjectBrowser->setMinimumWidth(DW_MINIMUM_WIDTH); // --- force a minimum until display + _dwObjectBrowser->setWindowTitle("Study"); } - _dwObjectBrowser->setMinimumWidth(DW_MINIMUM_WIDTH); // --- force a minimum until display - _dwObjectBrowser->setWindowTitle("Study"); // dock widget position - aParent->addDockWidget( Qt::LeftDockWidgetArea, _dwObjectBrowser ); + if ( _dwObjectBrowser ) { + aParent->addDockWidget( Qt::LeftDockWidgetArea, _dwObjectBrowser ); + } aParent->addDockWidget( Qt::RightDockWidgetArea, _dwInputPanel ); // aParent->tabifyDockWidget( _dwPattern, _dwObjectBrowser ); // aParent->tabifyDockWidget( _dwGroups, _dwPattern ); // aParent->tabifyDockWidget( _dwMesh, _dwGroups ); - aParent->tabifyDockWidget( _dwObjectBrowser, _dwPattern ); + if ( _dwObjectBrowser ) { + aParent->tabifyDockWidget( _dwObjectBrowser, _dwPattern ); + } aParent->tabifyDockWidget( _dwPattern, _dwGroups ); aParent->tabifyDockWidget( _dwGroups, _dwMesh );