Skip to content

Commit ea5d9c7

Browse files
call undomanager_flush on any playlist changes
1 parent aee4272 commit ea5d9c7

File tree

4 files changed

+5
-13
lines changed

4 files changed

+5
-13
lines changed

include/deadbeef/deadbeef.h

-2
Original file line numberDiff line numberDiff line change
@@ -1710,8 +1710,6 @@ typedef struct {
17101710
/// Please ensure that this function is not called from within @c pl_lock,
17111711
/// since this function internally uses streamer_lock, which may cause a deadlock against pl_lock.
17121712
ddb_playItem_t * (*streamer_get_playing_track_safe) (void);
1713-
1714-
void (*runloop_end)(void);
17151713
#endif
17161714
} DB_functions_t;
17171715

plugins/cocoaui/Playlist/PlaylistContentView.m

-5
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,6 @@ - (BOOL)performDragOperation:(id<NSDraggingInfo>)sender {
182182
[self.delegate dropItems:(int)from_playlist before:row indices:indices count:(int)length copy:op==NSDragOperationCopy];
183183
free(indices);
184184
}
185-
deadbeef->runloop_end();
186185
}
187186
if ([pboard.types containsObject:ddbMedialibItemUTIType]) {
188187
NSArray *classes = @[[MedialibItemDragDropHolder class]];
@@ -203,22 +202,19 @@ - (BOOL)performDragOperation:(id<NSDraggingInfo>)sender {
203202
}
204203
[self.delegate dropPlayItems:items before:row count:(int)itemCount];
205204
free (items);
206-
deadbeef->runloop_end();
207205
}
208206
else if ([pboard.types containsObject:NSFilenamesPboardType]) {
209207

210208
NSArray *paths = [pboard propertyListForType:NSFilenamesPboardType];
211209
if (row != (self.dataModel).invalidRow) {
212210
// add before selected row
213211
[self.delegate externalDropItems:paths after: [self.dataModel rowForIndex:sel-1] completionBlock:^{
214-
deadbeef->runloop_end();
215212
}];
216213
}
217214
else {
218215
// no selected row, add to end
219216
DdbListviewRow_t lastRow = [self.dataModel rowForIndex:((self.dataModel).rowCount-1)];
220217
[self.delegate externalDropItems:paths after:lastRow completionBlock:^{
221-
deadbeef->runloop_end();
222218
}];
223219
}
224220
}
@@ -1035,7 +1031,6 @@ - (void)keyDown:(NSEvent *)theEvent {
10351031
break;
10361032
default:
10371033
[super keyDown:theEvent];
1038-
deadbeef->runloop_end();
10391034
return;
10401035
}
10411036

src/main.c

+5
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
# include <config.h>
2929
#endif
3030
#include <assert.h>
31+
#include <dispatch/dispatch.h>
3132
#include <stdio.h>
3233
#include <stdint.h>
3334
#include <string.h>
@@ -951,6 +952,10 @@ player_mainloop (void) {
951952
streamer_notify_track_deleted ();
952953
break;
953954
}
955+
dispatch_async(dispatch_get_main_queue(), ^{
956+
undomanager_flush(undomanager_shared(), "Some Action");
957+
});
958+
// fallthrough
954959
case DB_EV_PAUSED:
955960
case DB_EV_SONGFINISHED:
956961
save_resume_state ();

src/plugins.c

-6
Original file line numberDiff line numberDiff line change
@@ -142,11 +142,6 @@ static void
142142
_viz_spectrum_listen_stub (void *ctx, void (*callback)(void *ctx, const ddb_audio_data_t *data)) {
143143
}
144144

145-
static void
146-
runloop_end(void) {
147-
undomanager_flush(undomanager_shared(), "Some Action");
148-
}
149-
150145
// deadbeef api
151146
static DB_functions_t deadbeef_api = {
152147
.vmajor = DB_API_VERSION_MAJOR,
@@ -539,7 +534,6 @@ static DB_functions_t deadbeef_api = {
539534
.plt_insert_dir3 = (ddb_playItem_t *(*) (int visibility, uint32_t flags, ddb_playlist_t *plt, ddb_playItem_t *after, const char *dirname, int *pabort, int (*callback)(ddb_insert_file_result_t result, const char *fname, void *user_data), void *user_data))plt_insert_dir3,
540535

541536
.streamer_get_playing_track_safe = (DB_playItem_t *(*) (void))streamer_get_playing_track,
542-
.runloop_end = runloop_end,
543537
};
544538

545539
DB_functions_t *deadbeef = &deadbeef_api;

0 commit comments

Comments
 (0)