Ensure RDHeaderView remains valid when deferring work

This commit is contained in:
baldurk
2017-12-07 15:09:51 +00:00
parent dff6ce1245
commit 80cb5b093a
+8 -3
View File
@@ -28,6 +28,7 @@
#include <QMouseEvent>
#include <QPainter>
#include <QPixmap>
#include <QPointer>
#include "Code/QRDUtils.h"
/////////////////////////////////////////////////////////////////////////////////
@@ -476,9 +477,13 @@ void RDHeaderView::setRootIndex(const QModelIndex &index)
// *before* the root index changes).
if(!m_sectionStretchHints.isEmpty())
{
GUIInvoke::defer([this]() {
cacheSectionMinSizes();
resizeSectionsWithHints();
QPointer<RDHeaderView> ptr;
GUIInvoke::defer([ptr]() {
if(ptr)
{
ptr->cacheSectionMinSizes();
ptr->resizeSectionsWithHints();
}
});
}
}