Don't append duplicates to openedInspectors

There is no benefit in storing the same pointer multiple times in
openedInspectors. This occurred when an article inspector window was
closed then shown again. When the tab corresponding to the duplicated
article inspector pointer was closed, ArticleInspector::beforeClosed()
erased only one pointer from openedInspectors. This left dangling
duplicate pointer(s) in the list and eventually caused a crash when
another inspector's showEvent() accessed a dangling pointer at
openedInspectors.front().
This commit is contained in:
Igor Kushnir 2022-10-29 13:32:17 +03:00 committed by Abs62
parent 9330c89e4b
commit cf84f57632

View file

@ -47,6 +47,7 @@ void ArticleInspector::showEvent( QShowEvent * event )
setGeometry( p->geometry() );
}
if( std::find( openedInspectors.begin(), openedInspectors.end(), this ) == openedInspectors.end() )
openedInspectors.push_back( this );
QWebInspector::showEvent( event );