[Qt-interest] Issue with softkeys on Symbian
Tomasz Baniak
thomas.baniak at gmail.com
Tue Nov 30 17:11:52 CET 2010
Hi!
Lately i stumbled upon a crash in an app i'm currently developing.
When i was clicking softkeys very fast on my app i run into some null
pointers/whatever pointers and eventually crashing.
i tried to reproduce the same issue on Windows (well, as long as Windows
does not have softkeys i used 'nearly' the same scenario) without any luck.
Here is what i do:
1) add softkey
2) connect it with some slot which is a bit heavy (for Symbian) and in the
slot i also delete the action with deleteLater() and set some other
action/no action in place
3) i start to click fast and bang goes the crash
I prepared a small example project that does moreover what my app would do.
Though i can't crash this app in the same way (i still did not found where i
crash in my app though i'm pretty sure it is connected with double
triggering actions) it still wonders me why am i failing on the ASSERTions.
Shouldn't it happen synchronously? I mean one slot finishes and then the
other and so on?
Why is it possible to trigger the same action twice even though it is
deleted, removed and nullified in a slot that is connected to trigger
signal?
compilable example attached
Regards,
Tomek
void MainWindow::actionTriggered()
{
Q_ASSERT(m_action2 == 0);
qDebug() << "actionTriggered()";
m_action->deleteLater();
removeAction(m_action);
m_action = 0;
m_action2 = new QAction("action 2", this);
m_action2->setSoftKeyRole(QAction::PositiveSoftKey);
connect(m_action2, SIGNAL(triggered()), this, SLOT(action2Triggered()));
addAction(m_action2);
someHeavyFunction();
}
void MainWindow::action2Triggered()
{
Q_ASSERT(m_action == 0);
qDebug() << "action2Triggered()";
m_action2->deleteLater();
removeAction(m_action2);
m_action2 = 0;
m_action = new QAction("action", this);
m_action->setSoftKeyRole(QAction::PositiveSoftKey);
connect(m_action, SIGNAL(triggered()), this, SLOT(actionTriggered()));
addAction(m_action);
someHeavyFunction();
}
void MainWindow::someHeavyFunction()
{
qDeleteAll(m_buttonList->begin(), m_buttonList->end());
m_buttonList->clear();
for (int i = 0; i<100;i++)
{
QPushButton *button = new QPushButton(this);
m_buttonList->append(button);
centralWidget()->layout()->addWidget(button);
}
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20101130/4b835755/attachment.html
-------------- next part --------------
A non-text attachment was scrubbed...
Name: FastClickingBug.zip
Type: application/zip
Size: 1957 bytes
Desc: not available
Url : http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20101130/4b835755/attachment.zip
More information about the Qt-interest-old
mailing list