mirror of
https://github.com/linuxdeepin/gio-qt.git
synced 2024-11-14 05:53:47 +01:00
fix: should disconnect when obj get destoryed
This commit is contained in:
parent
4fb8986d11
commit
8e0557c8c2
@ -26,8 +26,11 @@ using namespace Gio;
|
|||||||
|
|
||||||
class DGioMountOperationPrivate
|
class DGioMountOperationPrivate
|
||||||
{
|
{
|
||||||
|
public:
|
||||||
DGioMountOperationPrivate(DGioMountOperation *qq);
|
DGioMountOperationPrivate(DGioMountOperation *qq);
|
||||||
|
~DGioMountOperationPrivate();
|
||||||
|
|
||||||
|
private:
|
||||||
Glib::RefPtr<MountOperation> getGmmMountOperationInstance() const;
|
Glib::RefPtr<MountOperation> getGmmMountOperationInstance() const;
|
||||||
|
|
||||||
QString username() const;
|
QString username() const;
|
||||||
@ -36,6 +39,8 @@ class DGioMountOperationPrivate
|
|||||||
void slot_askQuestion(const Glib::ustring& message, const Glib::StringArrayHandle& choices);
|
void slot_askQuestion(const Glib::ustring& message, const Glib::StringArrayHandle& choices);
|
||||||
void slot_showUnmountProgress(const Glib::ustring &message, gint64 time_left, gint64 bytes_left);
|
void slot_showUnmountProgress(const Glib::ustring &message, gint64 time_left, gint64 bytes_left);
|
||||||
|
|
||||||
|
QList<sigc::connection> m_connections;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Glib::RefPtr<MountOperation> m_gmmMountOperationPtr;
|
Glib::RefPtr<MountOperation> m_gmmMountOperationPtr;
|
||||||
|
|
||||||
@ -49,9 +54,16 @@ DGioMountOperationPrivate::DGioMountOperationPrivate(DGioMountOperation *qq)
|
|||||||
{
|
{
|
||||||
m_gmmMountOperationPtr = Gio::MountOperation::create();
|
m_gmmMountOperationPtr = Gio::MountOperation::create();
|
||||||
|
|
||||||
m_gmmMountOperationPtr->signal_ask_password().connect(sigc::mem_fun(*this, &DGioMountOperationPrivate::slot_askPassword));
|
m_connections.append(m_gmmMountOperationPtr->signal_ask_password().connect(sigc::mem_fun(*this, &DGioMountOperationPrivate::slot_askPassword)));
|
||||||
m_gmmMountOperationPtr->signal_ask_question().connect(sigc::mem_fun(*this, &DGioMountOperationPrivate::slot_askQuestion));
|
m_connections.append(m_gmmMountOperationPtr->signal_ask_question().connect(sigc::mem_fun(*this, &DGioMountOperationPrivate::slot_askQuestion)));
|
||||||
m_gmmMountOperationPtr->signal_show_unmount_progress().connect(sigc::mem_fun(*this, &DGioMountOperationPrivate::slot_showUnmountProgress));
|
m_connections.append(m_gmmMountOperationPtr->signal_show_unmount_progress().connect(sigc::mem_fun(*this, &DGioMountOperationPrivate::slot_showUnmountProgress)));
|
||||||
|
}
|
||||||
|
|
||||||
|
DGioMountOperationPrivate::~DGioMountOperationPrivate()
|
||||||
|
{
|
||||||
|
for (auto & c : m_connections) {
|
||||||
|
c.disconnect();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Glib::RefPtr<MountOperation> DGioMountOperationPrivate::getGmmMountOperationInstance() const
|
Glib::RefPtr<MountOperation> DGioMountOperationPrivate::getGmmMountOperationInstance() const
|
||||||
|
Loading…
Reference in New Issue
Block a user