Merge lp:~thomas-voss/qtubuntu-media/disconnect-from-playback-status-changed-signal-on-destruction into lp:qtubuntu-media

Proposed by Thomas Voß
Status: Merged
Approved by: Alberto Aguirre
Approved revision: 52
Merged at revision: 51
Proposed branch: lp:~thomas-voss/qtubuntu-media/disconnect-from-playback-status-changed-signal-on-destruction
Merge into: lp:qtubuntu-media
Diff against target: 66 lines (+9/-1)
3 files modified
src/aal/aalmediaplayerservice.cpp (+6/-1)
src/aal/aalmediaplayerservice.h (+1/-0)
src/aal/aalmediaplayerserviceplugin.cpp (+2/-0)
To merge this branch: bzr merge lp:~thomas-voss/qtubuntu-media/disconnect-from-playback-status-changed-signal-on-destruction
Reviewer Review Type Date Requested Status
Alberto Aguirre (community) Approve
PS Jenkins bot continuous-integration Needs Fixing
Review via email: mp+240256@code.launchpad.net

This proposal supersedes a proposal from 2014-10-31.

Commit message

Cut event connections on destruction.

Description of the change

Cut event connections on destruction.

To post a comment you must log in.
Revision history for this message
Michał Sawicz (saviq) wrote : Posted in a previous version of this proposal

Submit against trunk

review: Needs Resubmitting
52. By Thomas Voß

Adjust naming of member to match project guidelines.
Disconnect signal as early as possible during destruction.

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Alberto Aguirre (albaguirre) wrote :

LGTM

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/aal/aalmediaplayerservice.cpp'
2--- src/aal/aalmediaplayerservice.cpp 2014-10-16 02:17:27 +0000
3+++ src/aal/aalmediaplayerservice.cpp 2014-10-31 13:07:22 +0000
4@@ -55,11 +55,14 @@
5 core::ubuntu::media::Player::PlaybackCompleteCb empty_playback_complete_cb = [](void*)
6 {
7 };
8+
9+core::Signal<void> the_void;
10 }
11
12 AalMediaPlayerService::AalMediaPlayerService(QObject *parent):
13 QMediaService(parent),
14 m_hubPlayerSession(NULL),
15+ m_playbackStatusChangedConnection(the_void.connect([](){})),
16 m_videoOutputReady(false),
17 m_mediaPlayerControlRef(0),
18 m_videoOutputRef(0),
19@@ -83,12 +86,14 @@
20 createMediaPlayerControl();
21 createVideoRendererControl();
22
23- m_hubPlayerSession->playback_status_changed().connect(
24+ m_playbackStatusChangedConnection = m_hubPlayerSession->playback_status_changed().connect(
25 std::bind(&AalMediaPlayerService::onPlaybackStatusChanged, this, _1));
26 }
27
28 AalMediaPlayerService::~AalMediaPlayerService()
29 {
30+ m_playbackStatusChangedConnection.disconnect();
31+
32 deleteMediaPlayerControl();
33 deleteVideoRendererControl();
34 }
35
36=== modified file 'src/aal/aalmediaplayerservice.h'
37--- src/aal/aalmediaplayerservice.h 2014-10-16 02:17:27 +0000
38+++ src/aal/aalmediaplayerservice.h 2014-10-31 13:07:22 +0000
39@@ -111,6 +111,7 @@
40
41 std::shared_ptr<core::ubuntu::media::Service> m_hubService;
42 std::shared_ptr<core::ubuntu::media::Player> m_hubPlayerSession;
43+ core::Connection m_playbackStatusChangedConnection;
44
45 AalMediaPlayerControl *m_mediaPlayerControl;
46 AalVideoRendererControl *m_videoOutput;
47
48=== modified file 'src/aal/aalmediaplayerserviceplugin.cpp'
49--- src/aal/aalmediaplayerserviceplugin.cpp 2014-10-15 09:26:40 +0000
50+++ src/aal/aalmediaplayerserviceplugin.cpp 2014-10-31 13:07:22 +0000
51@@ -26,6 +26,7 @@
52
53 QMediaService* AalServicePlugin::create(QString const& key)
54 {
55+ qDebug() << Q_FUNC_INFO << key;
56 if (key == QLatin1String(Q_MEDIASERVICE_MEDIAPLAYER))
57 return new AalMediaPlayerService();
58 else
59@@ -36,6 +37,7 @@
60
61 void AalServicePlugin::release(QMediaService *service)
62 {
63+ qDebug() << Q_FUNC_INFO << service;
64 Q_UNUSED(service);
65 delete service;
66 }

Subscribers

People subscribed via source and target branches