[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#983597: [PATCH] Segfault in libqt5quick5.so: QQuickItemLayer::~QQuickItemLayer()



Hi Dennis,

In data venerdì 26 febbraio 2021 22:48:43 CET, Dennis Filder ha scritto:
> If you decide to use the attached patch, please put the bugnumber in
> the Bug-Debian: field for me.

The patch you provided is the following:

--- qtdeclarative-opensource-src-5.15.2+dfsg/src/quick/items/qquickitem.cpp     2021-02-26 18:48:50.407487828 +0100
+++ qtdeclarative-opensource-src-5.15.2+dfsg/src/quick/items/qquickitem.cpp     2021-02-26 18:48:52.711491373 +0100
@@ -8335,8 +8335,8 @@

 QQuickItemLayer::~QQuickItemLayer()
 {
-    delete m_effectSource;
-    delete m_effect;
+    if (m_effectSource) delete m_effectSource; // FIXME: consider Q_ASSERT() here instead
+    if (m_effect) delete m_effect; // FIXME: consider Q_ASSERT() here instead
 }

 /*!

Did you actually check that it fixes the problem for you?
The thing is, in C++ (at least since C++98) the delete operator is
defined to be a no-op for a null pointer, much like free() in C.
Hence, constructs like "if (foo) delete foo;" are essentially doing
null pointer checks twice, and with the same no-op result.

A possible cause of the crash could be that the item being deleted was
already deleted, and thus there was a stale pointer somewhere. That is
my own speculation though.

Because of this, I'm inclined to remove the "patch" tag from this bug;
I'd like to hear from Dmitry what he thinks about it (since he already
handled this bug).

-- 
Pino Toscano

Attachment: signature.asc
Description: This is a digitally signed message part.


Reply to: