* ./hurricane/src/hviewer :
- Bug: very tricky one. Do not emit "layoutAboutToChange()" signal after destroying the Record used by the RecordModel but before setting a new one and not setting the _record field to NULL. Now setRootRecord() should work more than once.
This commit is contained in:
parent
fd0051802b
commit
5328240c21
|
@ -160,12 +160,12 @@ namespace Hurricane {
|
|||
|
||||
void CellViewer::runInspector ( Record* record )
|
||||
{
|
||||
//cerr << "INITIAL Records: " << Record::getAllocateds() << endl;
|
||||
//cerr << "INITIAL Slots: " << Slot::getAllocateds() << endl;
|
||||
//cerr << "Inspector created." << endl;
|
||||
static HInspectorWidget* inspector = NULL;
|
||||
|
||||
if ( record ) {
|
||||
HInspectorWidget* inspector = new HInspectorWidget ();
|
||||
//if ( !inspector )
|
||||
inspector = new HInspectorWidget ();
|
||||
|
||||
inspector->setRootRecord ( record );
|
||||
inspector->show ();
|
||||
} else
|
||||
|
|
|
@ -91,17 +91,17 @@ namespace Hurricane {
|
|||
void HInspectorWidget::History::clear ( bool inDelete )
|
||||
{
|
||||
if ( !_slots.empty() ) {
|
||||
// Delete the rootRecord only if it'not the current viewed record.
|
||||
if ( _depth != 0 ) {
|
||||
delete _slots[0]->getDataRecord();
|
||||
}
|
||||
_comboBox->clear ();
|
||||
|
||||
// Delete the rootRecord as it's the only one not deleted
|
||||
// automatically through RecordModel (case of depth 0).
|
||||
delete _slots[0]->getDataRecord();
|
||||
|
||||
for ( size_t i=0 ; i < _slots.size() ; i++ )
|
||||
delete _slots[i];
|
||||
|
||||
_slots.clear ();
|
||||
if ( !inDelete )
|
||||
_comboBox->clear ();
|
||||
_depth = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -124,7 +124,6 @@ namespace Hurricane {
|
|||
Slot* rootSlot = ::getSlot ( "<TopLevelSlot>", rootRecord );
|
||||
_slots.push_back ( rootSlot );
|
||||
_comboBox->addItem ( QString("%1: %2").arg(_depth).arg(_slots[_slots.size()-1]->getDataString().c_str()));
|
||||
_depth = 0;
|
||||
}
|
||||
|
||||
|
||||
|
@ -277,6 +276,8 @@ namespace Hurricane {
|
|||
|
||||
void HInspectorWidget::historyChanged ( int depth )
|
||||
{
|
||||
if ( depth < 0 ) return;
|
||||
|
||||
_history.goTo ( depth );
|
||||
setSlot ();
|
||||
}
|
||||
|
|
|
@ -20,7 +20,7 @@ namespace Hurricane {
|
|||
|
||||
RecordModel::~RecordModel ()
|
||||
{
|
||||
delete _record;
|
||||
if ( _depth ) delete _record;
|
||||
delete _slot;
|
||||
}
|
||||
|
||||
|
@ -33,8 +33,6 @@ namespace Hurricane {
|
|||
return false;
|
||||
}
|
||||
|
||||
emit layoutAboutToBeChanged ();
|
||||
|
||||
if ( _depth ) delete _record;
|
||||
if ( _slot ) delete _slot;
|
||||
|
||||
|
@ -99,7 +97,6 @@ namespace Hurricane {
|
|||
|
||||
int RecordModel::rowCount ( const QModelIndex& parent ) const
|
||||
{
|
||||
|
||||
return (_record) ? _record->_getSlotList().size() : 0;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue