mirror of
https://github.com/SpartanJ/eepp.git
synced 2026-05-30 10:06:35 +03:00
FileSystemModel: Crash fix on invalid file event.
This commit is contained in:
@@ -134,8 +134,8 @@ class EE_API Model {
|
||||
ModelIndex const& targetParent, int target_index );
|
||||
void beginMoveColumns( ModelIndex const& sourceParent, int first, int last,
|
||||
ModelIndex const& targetParent, int target_index );
|
||||
void beginDeleteRows( ModelIndex const& parent, int first, int last );
|
||||
void beginDeleteColumns( ModelIndex const& parent, int first, int last );
|
||||
bool beginDeleteRows( ModelIndex const& parent, int first, int last );
|
||||
bool beginDeleteColumns( ModelIndex const& parent, int first, int last );
|
||||
|
||||
void endInsertRows();
|
||||
void endInsertColumns();
|
||||
|
||||
@@ -678,12 +678,11 @@ bool FileSystemModel::handleFileEventLocked( const FileEvent& event ) {
|
||||
} );
|
||||
} );
|
||||
|
||||
beginDeleteRows( index.parent(), index.row(), index.row() );
|
||||
|
||||
eeDelete( parent->mChildren[index.row()] );
|
||||
parent->mChildren.erase( parent->mChildren.begin() + index.row() );
|
||||
|
||||
endDeleteRows();
|
||||
if ( beginDeleteRows( index.parent(), index.row(), index.row() ) ) {
|
||||
eeDelete( parent->mChildren[index.row()] );
|
||||
parent->mChildren.erase( parent->mChildren.begin() + index.row() );
|
||||
endDeleteRows();
|
||||
}
|
||||
|
||||
forEachView( [&]( UIAbstractView* view ) {
|
||||
std::vector<ModelIndex> newIndexes;
|
||||
|
||||
@@ -93,22 +93,22 @@ void Model::beginMoveColumns( ModelIndex const& sourceParent, int first, int las
|
||||
targetParent, targetIndex } );
|
||||
}
|
||||
|
||||
void Model::beginDeleteRows( ModelIndex const& parent, int first, int last ) {
|
||||
eeASSERT( first >= 0 );
|
||||
eeASSERT( first <= last );
|
||||
eeASSERT( (size_t)last < rowCount( parent ) );
|
||||
|
||||
saveDeletedIndices<true>( parent, first, last );
|
||||
mOperationStack.push( { OperationType::Delete, Direction::Row, parent, first, last } );
|
||||
bool Model::beginDeleteRows( ModelIndex const& parent, int first, int last ) {
|
||||
if ( first >= 0 && first <= last && (size_t)last < rowCount( parent ) ) {
|
||||
saveDeletedIndices<true>( parent, first, last );
|
||||
mOperationStack.push( { OperationType::Delete, Direction::Row, parent, first, last } );
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void Model::beginDeleteColumns( ModelIndex const& parent, int first, int last ) {
|
||||
eeASSERT( first >= 0 );
|
||||
eeASSERT( first <= last );
|
||||
eeASSERT( (size_t)last < columnCount( parent ) );
|
||||
|
||||
saveDeletedIndices<false>( parent, first, last );
|
||||
mOperationStack.push( { OperationType::Delete, Direction::Column, parent, first, last } );
|
||||
bool Model::beginDeleteColumns( ModelIndex const& parent, int first, int last ) {
|
||||
if ( first >= 0 && first <= last && (size_t)last < columnCount( parent ) ) {
|
||||
saveDeletedIndices<false>( parent, first, last );
|
||||
mOperationStack.push( { OperationType::Delete, Direction::Column, parent, first, last } );
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
std::weak_ptr<PersistentHandle> Model::registerPersistentIndex( ModelIndex const& index ) {
|
||||
|
||||
Reference in New Issue
Block a user