Unsolved Weird crash with QGesture
-
Hi,
How are you deleting your widget ?
-
Hi,
function close() is called in a slot. Then an event (deferredDelete) actually call delete on the widget.
This widget is embedded in a MDIArea.It's not happening at every close of the widget.
-
I switched from the Qt 4.8.6 from debian package to a 4.8.6 builded from source with the define QT_NO_GESTURES.
The crash seems to be avoided.Is there a way to disable all the treatment that Qt do for Gesture management, as we do not use them in our project, without compiling from source ?
-
Something's not clear, you are calling close and then deleteLater on your widget ?
-
No, i think that the close() call implicate a DeferedDelete event (Qt mechanism).
-
No it doesn't unless you have set the the
Qt::WA_DeleteOnClose
attribute. Otherwise it hides the widget. -
Yes, the attribute is actually set .
By the way, i have found another way to reproduce the problem and this time i initiate the delete of the widget manually, without close().
The idea is :
i have a QSplitter, the QSplitter is used as a container for 2 widgets. The two widgets are called "upper" and "bottom" area. The upper part in this case contains a list of items. When user click an item, we display a "bottom" part with details on the item selected in the "upper" part.
The crash happens (sometimes) when we switch the "bottom" part.In this code, m_pBottomArea is the current bottom, pNewBottomArea is the one we want to set.
if (m_pBottomArea != NULL) { //Already a bottom: delete it, this will remove it from splitter delete m_pBottomArea; //m_pBottomArea->deleteLater; } m_pBottomArea = pNewBottomArea; if (m_pBottomArea != NULL) { //Add the bottom m_pSplitter->insertWidget(1, m_pBottomArea); }
Either if i use a delete, or a deleteLater, there is sometimes a crash. Always with the same call stack.
Did i do something wrong ?
Do you know if there is a way to disable the GestureManager without compiling Qt from source ? -
AFAIK, no.
One thing you can try is to set
m_pBottomArea
's parent tonullptr
before deleting it. -
Already tried that :(
-
Can you share the complete implementation of the function where you manipulate
m_pBottomArea
? The handlingpNewBottomArea
is absent and the look of the code looks like it might be more complicated that necessary.