From 29030b54c98b0aee65fbc10ebf7ba36bed98c02c Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Sat, 10 Aug 2013 18:02:44 +0200 Subject: util/Error: new error passing library Replaces GLib's GError. --- src/PlayerControl.cxx | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) (limited to 'src/PlayerControl.cxx') diff --git a/src/PlayerControl.cxx b/src/PlayerControl.cxx index 357cdfc17..3fd09a8d1 100644 --- a/src/PlayerControl.cxx +++ b/src/PlayerControl.cxx @@ -40,7 +40,6 @@ player_control::player_control(unsigned _buffer_chunks, command(PLAYER_COMMAND_NONE), state(PLAYER_STATE_STOP), error_type(PLAYER_ERROR_NONE), - error(nullptr), next_song(nullptr), cross_fade_seconds(0), mixramp_db(0), @@ -216,16 +215,13 @@ player_control::GetStatus() } void -player_control::SetError(player_error type, GError *_error) +player_control::SetError(player_error type, Error &&_error) { assert(type != PLAYER_ERROR_NONE); - assert(_error != NULL); - - if (error_type != PLAYER_ERROR_NONE) - g_error_free(error); + assert(_error.IsDefined()); error_type = type; - error = _error; + error = std::move(_error); } void @@ -235,7 +231,7 @@ player_control::ClearError() if (error_type != PLAYER_ERROR_NONE) { error_type = PLAYER_ERROR_NONE; - g_error_free(error); + error.Clear(); } Unlock(); @@ -246,7 +242,7 @@ player_control::GetErrorMessage() const { Lock(); char *message = error_type != PLAYER_ERROR_NONE - ? g_strdup(error->message) + ? g_strdup(error.GetMessage()) : NULL; Unlock(); return message; -- cgit v1.2.3