core/renderbackend: check for the renderloop being deleted
Output frames can outlive the output they were created for, so the render loop might also be deleted by the time the output frame is destroyed or presented BUG: 487701
This commit is contained in:
parent
4b58f6c207
commit
0c5ee47892
2 changed files with 5 additions and 3 deletions
|
@ -54,7 +54,7 @@ OutputFrame::OutputFrame(RenderLoop *loop, std::chrono::nanoseconds refreshDurat
|
|||
OutputFrame::~OutputFrame()
|
||||
{
|
||||
Q_ASSERT(QThread::currentThread() == QCoreApplication::instance()->thread());
|
||||
if (!m_presented) {
|
||||
if (!m_presented && m_loop) {
|
||||
RenderLoopPrivate::get(m_loop)->notifyFrameDropped();
|
||||
}
|
||||
}
|
||||
|
@ -87,7 +87,9 @@ std::optional<std::chrono::nanoseconds> OutputFrame::queryRenderTime() const
|
|||
void OutputFrame::presented(std::chrono::nanoseconds timestamp, PresentationMode mode)
|
||||
{
|
||||
std::optional<std::chrono::nanoseconds> renderTime = queryRenderTime();
|
||||
RenderLoopPrivate::get(m_loop)->notifyFrameCompleted(timestamp, renderTime, mode);
|
||||
if (m_loop) {
|
||||
RenderLoopPrivate::get(m_loop)->notifyFrameCompleted(timestamp, renderTime, mode);
|
||||
}
|
||||
m_presented = true;
|
||||
for (const auto &feedback : m_feedbacks) {
|
||||
feedback->presented(m_refreshDuration, timestamp, mode);
|
||||
|
|
|
@ -97,7 +97,7 @@ public:
|
|||
private:
|
||||
std::optional<std::chrono::nanoseconds> queryRenderTime() const;
|
||||
|
||||
RenderLoop *const m_loop;
|
||||
const QPointer<RenderLoop> m_loop;
|
||||
const std::chrono::nanoseconds m_refreshDuration;
|
||||
const std::chrono::steady_clock::time_point m_targetPageflipTime;
|
||||
std::vector<std::unique_ptr<PresentationFeedback>> m_feedbacks;
|
||||
|
|
Loading…
Reference in a new issue