File fix-crashes-444132.diff of Package PolicyKit-kde
Index: src/policykitkde.cpp
===================================================================
--- src/policykitkde.cpp (revision 883301)
+++ src/policykitkde.cpp (revision 883307)
@@ -296,7 +296,6 @@
connect( m_self->dialog, SIGNAL( okClicked()), &loop, SLOT( quit()));
connect( m_self->dialog, SIGNAL( cancelClicked()), &loop, SLOT( quit()));
loop.exec(); // TODO this really sucks, policykit API is blocking
- QTimer::singleShot( 0, m_self, SLOT( finishObtainPrivilege()));
if( m_self->cancelled )
return NULL;
return strdup( m_self->dialog->password().toLocal8Bit());
@@ -400,6 +399,7 @@
{
kDebug() << "conversation_done" << grant << obtainedPrivilege << invalidData;
m_self->obtainedPrivilege = obtainedPrivilege;
+ QTimer::singleShot( 0, m_self, SLOT( finishObtainPrivilege()));
}
//----------------------------------------------------------------------------
@@ -425,6 +425,7 @@
notify->connect(notify, SIGNAL(activated(int)), m_self, SLOT(watchActivatedGrant(int)));
return fd; // use simply the fd as the unique id for the watch
+ // TODO this will be insufficient if there will be more watches for the same fd
}
@@ -434,7 +435,8 @@
{
assert( id > 0 );
kDebug() << "remove_watch" << grant << id;
- Q_ASSERT(m_self->m_watches.contains(id));
+ if( !m_self->m_watches.contains(id))
+ return; // policykit likes to do this more than once
QSocketNotifier* notify = m_self->m_watches.take(id);
notify->deleteLater();
@@ -473,7 +475,8 @@
{
assert( id > 0 );
kDebug() << "remove_watch" << context << id;
- Q_ASSERT(m_self->m_watches.contains(id));
+ if( !m_self->m_watches.contains(id))
+ return; // policykit likes to do this more than once
QSocketNotifier* notify = m_self->m_watches.take(id);
notify->deleteLater();