qpulse: properly deref requested operation objects

This commit is contained in:
mappu 2018-10-02 19:27:51 +13:00
parent ce5b1e52d3
commit 0cda1431ec
2 changed files with 16 additions and 6 deletions

View File

@ -27,18 +27,28 @@ pa_context_state_t QPulse::ConnectionState()
return pa_context_get_state(c); return pa_context_get_state(c);
} }
void QPulse::RequestServerInfo() bool QPulse::RequestServerInfo()
{ {
//ThreadedMainLoopLock lock(ml); //ThreadedMainLoopLock lock(ml);
pa_context_get_server_info(c, &QPulse::onGotServerInfoSt, this); pa_operation* o = pa_context_get_server_info(c, &QPulse::onGotServerInfoSt, this);
if (! o) {
return false;
} }
void QPulse::RequestCardInfo() pa_operation_unref(o);
}
bool QPulse::RequestCardInfo()
{ {
//ThreadedMainLoopLock lock(ml); //ThreadedMainLoopLock lock(ml);
pa_context_get_card_info_list(c, &QPulse::onGotCardInfoListSt, this); pa_operation* o = pa_context_get_card_info_list(c, &QPulse::onGotCardInfoListSt, this);
if (! o) {
return false;
}
pa_operation_unref(o);
} }
void QPulse::onGotCardInfoListSt(pa_context*, const pa_card_info *i, int eol, void *userdata) void QPulse::onGotCardInfoListSt(pa_context*, const pa_card_info *i, int eol, void *userdata)

View File

@ -13,8 +13,8 @@ public:
pa_context_state_t ConnectionState(); pa_context_state_t ConnectionState();
void RequestServerInfo(); bool RequestServerInfo();
void RequestCardInfo(); bool RequestCardInfo();
signals: signals:
void ConnectionStateChanged(); void ConnectionStateChanged();