Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
mpd
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Иван Мажукин
mpd
Commits
13192546
Commit
13192546
authored
Dec 17, 2008
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
playlist: clear pc.errored_song on delete
When a (remote) song is deleted from the playlist, there may still be a reference to it in pc.errored_song. Clear this reference.
parent
25c04a97
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
23 additions
and
2 deletions
+23
-2
player_control.c
src/player_control.c
+7
-0
player_control.h
src/player_control.h
+8
-0
playlist.c
src/playlist.c
+8
-2
No files found.
src/player_control.c
View file @
13192546
...
@@ -44,6 +44,13 @@ void pc_deinit(void)
...
@@ -44,6 +44,13 @@ void pc_deinit(void)
notify_deinit
(
&
pc
.
notify
);
notify_deinit
(
&
pc
.
notify
);
}
}
void
pc_song_deleted
(
const
struct
song
*
song
)
{
if
(
pc
.
errored_song
==
song
)
pc
.
errored_song
=
NULL
;
}
static
void
player_command
(
enum
player_command
cmd
)
static
void
player_command
(
enum
player_command
cmd
)
{
{
pc
.
command
=
cmd
;
pc
.
command
=
cmd
;
...
...
src/player_control.h
View file @
13192546
...
@@ -84,6 +84,14 @@ void pc_init(unsigned int buffered_before_play);
...
@@ -84,6 +84,14 @@ void pc_init(unsigned int buffered_before_play);
void
pc_deinit
(
void
);
void
pc_deinit
(
void
);
/**
* Call this function when the specified song pointer is about to be
* invalidated. This makes sure that player_control.errored_song does
* not point to an invalid pointer.
*/
void
pc_song_deleted
(
const
struct
song
*
song
);
void
void
playerPlay
(
struct
song
*
song
);
playerPlay
(
struct
song
*
song
);
...
...
src/playlist.c
View file @
13192546
...
@@ -200,8 +200,10 @@ void clearPlaylist(void)
...
@@ -200,8 +200,10 @@ void clearPlaylist(void)
stopPlaylist
();
stopPlaylist
();
for
(
unsigned
i
=
0
;
i
<
playlist
.
length
;
i
++
)
{
for
(
unsigned
i
=
0
;
i
<
playlist
.
length
;
i
++
)
{
if
(
!
song_in_database
(
playlist
.
songs
[
i
]))
if
(
!
song_in_database
(
playlist
.
songs
[
i
]))
{
pc_song_deleted
(
playlist
.
songs
[
i
]);
song_free
(
playlist
.
songs
[
i
]);
song_free
(
playlist
.
songs
[
i
]);
}
playlist
.
idToPosition
[
playlist
.
positionToId
[
i
]]
=
-
1
;
playlist
.
idToPosition
[
playlist
.
positionToId
[
i
]]
=
-
1
;
playlist
.
songs
[
i
]
=
NULL
;
playlist
.
songs
[
i
]
=
NULL
;
...
@@ -670,8 +672,10 @@ enum playlist_result deleteFromPlaylist(unsigned song)
...
@@ -670,8 +672,10 @@ enum playlist_result deleteFromPlaylist(unsigned song)
||
playlist
.
order
[
playlist
.
current
]
==
song
))
||
playlist
.
order
[
playlist
.
current
]
==
song
))
clearPlayerQueue
();
clearPlayerQueue
();
if
(
!
song_in_database
(
playlist
.
songs
[
song
]))
if
(
!
song_in_database
(
playlist
.
songs
[
song
]))
{
pc_song_deleted
(
playlist
.
songs
[
song
]);
song_free
(
playlist
.
songs
[
song
]);
song_free
(
playlist
.
songs
[
song
]);
}
playlist
.
idToPosition
[
playlist
.
positionToId
[
song
]]
=
-
1
;
playlist
.
idToPosition
[
playlist
.
positionToId
[
song
]]
=
-
1
;
...
@@ -738,6 +742,8 @@ deleteASongFromPlaylist(const struct song *song)
...
@@ -738,6 +742,8 @@ deleteASongFromPlaylist(const struct song *song)
for
(
unsigned
i
=
0
;
i
<
playlist
.
length
;
i
++
)
for
(
unsigned
i
=
0
;
i
<
playlist
.
length
;
i
++
)
if
(
song
==
playlist
.
songs
[
i
])
if
(
song
==
playlist
.
songs
[
i
])
deleteFromPlaylist
(
i
);
deleteFromPlaylist
(
i
);
pc_song_deleted
(
song
);
}
}
void
stopPlaylist
(
void
)
void
stopPlaylist
(
void
)
...
...
Write
Preview
Markdown
is supported
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