mirror of
https://github.com/xiaoyifang/goldendict-ng.git
synced 2024-11-24 08:34:08 +00:00
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:
parent
9330c89e4b
commit
cf84f57632
|
@ -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 );
|
||||
|
|
Loading…
Reference in a new issue