Commit fce79085 authored by Michael Pyne's avatar Michael Pyne
Browse files

Address undefined behavior during shutdown.

Event filters strike again, along with our old friend, sibling ordering
dependencies not captured by the Qt memory hierarchy. Again, noted by
ubsan.
parent 66ddbb3b
......@@ -565,6 +565,8 @@ CollectionListItem::~CollectionListItem()
l->removeStringFromDict(file().tag()->artist(), ArtistColumn);
l->removeStringFromDict(file().tag()->genre(), GenreColumn);
}
m_collectionItem = nullptr;
}
void CollectionListItem::addChildItem(PlaylistItem *child)
......
......@@ -187,6 +187,12 @@ PlaylistBox::~PlaylistBox()
Cache::savePlaylists(l);
saveConfig();
// Some view modes use event filters onto sibling widgets which may be
// destroyed before the view mode.
// Manually delete the view modes instead.
qDeleteAll(m_viewModes);
m_viewModes.clear();
}
void PlaylistBox::raise(Playlist *playlist)
......
......@@ -52,7 +52,9 @@ PlaylistItem::~PlaylistItem()
// stark advantage of working reliably. I'll tell anyone who tries to
// optimize this, the timing issues can be *hard*. -- mpyne
m_collectionItem->removeChildItem(this);
if(m_collectionItem) {
m_collectionItem->removeChildItem(this);
}
if(m_playingItems.contains(this)) {
m_playingItems.removeAll(this);
......
......@@ -43,7 +43,7 @@ ViewMode::ViewMode(PlaylistBox *b) :
ViewMode::~ViewMode()
{
removeEventFilter(m_playlistBox->viewport());
}
bool ViewMode::eventFilter(QObject *watched, QEvent *e)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment