Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
System
Apper
Commits
dbfb2d03
Commit
dbfb2d03
authored
Apr 02, 2012
by
Daniel Nicoletti
Browse files
Fix crash when quiting apper-sentinel due to late deleting
BUG: 255935
parent
26fc51cc
Changes
4
Hide whitespace changes
Inline
Side-by-side
Sentinel/DBusInterface.cpp
View file @
dbfb2d03
...
...
@@ -28,6 +28,8 @@
#ifdef HAVE_DEBCONFKDE
#include <KDialog>
#include <KWindowSystem>
#include <Transaction>
using
namespace
PackageKit
;
#endif
#include <KDebug>
...
...
@@ -50,12 +52,6 @@ DBusInterface::DBusInterface(QObject *parent)
DBusInterface
::~
DBusInterface
()
{
kDebug
();
#ifdef HAVE_DEBCONFKDE
foreach
(
const
DebconfGui
*
gui
,
m_debconfGuis
.
values
())
{
delete
gui
;
}
#endif //HAVE_DEBCONFKDE
}
void
DBusInterface
::
RefreshCache
()
...
...
@@ -76,14 +72,26 @@ void DBusInterface::RefreshAndUpdate()
emit
refreshAndUpdate
(
true
);
}
void
DBusInterface
::
SetupDebconfDialog
(
const
QString
&
socketPath
,
uint
xidParent
)
void
DBusInterface
::
SetupDebconfDialog
(
const
QString
&
tid
,
const
QString
&
socketPath
,
uint
xidParent
)
{
#ifdef HAVE_DEBCONFKDE
kDebug
()
<<
socketPath
<<
xidParent
;
kDebug
()
<<
tid
<<
socketPath
<<
xidParent
;
DebconfGui
*
gui
;
if
(
m_debconfGuis
.
contains
(
socketPath
))
{
gui
=
m_debconfGuis
[
socketPath
];
}
else
{
// Create the Transaction object to delete
// the DebconfGui class when the transaction finishes
Transaction
*
transaction
=
new
Transaction
(
tid
);
if
(
transaction
->
error
())
{
transaction
->
deleteLater
();
return
;
}
transaction
->
setProperty
(
"socketPath"
,
socketPath
);
connect
(
transaction
,
SIGNAL
(
finished
(
PackageKit
::
Transaction
::
Exit
,
uint
)),
this
,
SLOT
(
transactionFinished
()));
// Setup the Debconf dialog
gui
=
new
DebconfGui
(
socketPath
);
gui
->
setWindowModality
(
Qt
::
WindowModal
);
gui
->
setWindowFlags
(
Qt
::
Dialog
);
...
...
@@ -111,4 +119,15 @@ void DBusInterface::debconfActivate()
#endif
}
void
DBusInterface
::
transactionFinished
()
{
#ifdef HAVE_DEBCONFKDE
QString
socketPath
=
sender
()
->
property
(
"socketPath"
).
toString
();
if
(
m_debconfGuis
.
contains
(
socketPath
))
{
// remove the gui from the list and also delete it
m_debconfGuis
.
take
(
socketPath
)
->
deleteLater
();
}
#endif // HAVE_DEBCONFKDE
}
#include "DBusInterface.moc"
Sentinel/DBusInterface.h
View file @
dbfb2d03
...
...
@@ -40,7 +40,7 @@ public:
void
RefreshCache
();
void
RefreshAndUpdate
();
void
Update
();
void
SetupDebconfDialog
(
const
QString
&
socket
_p
ath
,
uint
xid
_p
arent
);
void
SetupDebconfDialog
(
const
QString
&
tid
,
const
QString
&
socket
P
ath
,
uint
xid
P
arent
);
signals:
void
refreshAndUpdate
(
bool
refresh
);
...
...
@@ -48,6 +48,7 @@ signals:
private
slots
:
void
debconfActivate
();
void
transactionFinished
();
#ifdef HAVE_DEBCONFKDE
private:
...
...
Sentinel/org.kde.ApperSentinel.xml
View file @
dbfb2d03
...
...
@@ -8,6 +8,7 @@
<method
name=
"RefreshAndUpdate"
>
</method>
<method
name=
"SetupDebconfDialog"
>
<arg
type=
"s"
name=
"tid"
direction=
"in"
/>
<arg
type=
"s"
name=
"socket_path"
direction=
"in"
/>
<arg
type=
"u"
name=
"xid_parent"
direction=
"in"
/>
</method>
...
...
libapper/PkTransaction.cpp
View file @
dbfb2d03
...
...
@@ -32,6 +32,7 @@
#include <KDebug>
#include <QStringBuilder>
#include <QPropertyAnimation>
#include <QtDBus/QDBusMessage>
#include <QtDBus/QDBusConnection>
...
...
@@ -220,14 +221,18 @@ void PkTransaction::setupTransaction(PackageKit::Transaction *transaction)
SET_PROXY
;
#ifdef HAVE_DEBCONFKDE
QString
tid
;
QString
socket
;
socket
=
QLatin1String
(
"/tmp/debconf_"
)
+
transaction
->
tid
().
remove
(
'/'
);
tid
=
transaction
->
tid
();
// Build a socket path like /tmp/1761_edeceabd_data_debconf
socket
=
QLatin1String
(
"/tmp"
)
%
tid
%
QLatin1String
(
"_debconf"
);
QDBusMessage
message
;
message
=
QDBusMessage
::
createMethodCall
(
"org.kde.ApperSentinel"
,
"/"
,
"org.kde.ApperSentinel"
,
message
=
QDBusMessage
::
createMethodCall
(
QLatin1String
(
"org.kde.ApperSentinel"
)
,
QLatin1String
(
"/"
)
,
QLatin1String
(
"org.kde.ApperSentinel"
)
,
QLatin1String
(
"SetupDebconfDialog"
));
// Use our own cached tid to avoid crashes
message
<<
qVariantFromValue
(
tid
);
message
<<
qVariantFromValue
(
socket
);
message
<<
qVariantFromValue
(
static_cast
<
uint
>
(
effectiveWinId
()));
QDBusMessage
reply
=
QDBusConnection
::
sessionBus
().
call
(
message
);
...
...
@@ -235,7 +240,7 @@ void PkTransaction::setupTransaction(PackageKit::Transaction *transaction)
kWarning
()
<<
"Message did not receive a reply"
;
}
transaction
->
setHints
(
"frontend-socket="
+
socket
);
transaction
->
setHints
(
QLatin1String
(
"frontend-socket="
)
%
socket
);
#else
Q_UNUSED
(
transaction
)
#endif //HAVE_DEBCONFKDE
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment