Help - Search - Members - Calendar
Full Version: Error when shutting down foobar
Hydrogenaudio Forums > Hosted Forums > foobar2000 > Development - (fb2k)
eyebex
I seem to do something wrong in my component, as it triggers an error "Unhandled exception : Service duplicated" when shutting down foobar. Any idea what might cause this? My component basically just reports some information about the currently playing song and introduces a new configuration page with a few options. I probably just forgot to unregister something, but I do not know what.

Thanks.
foosion
There are two possible causes for this error:
  • You are reimplementing a core services that is not meant to be reimplemented. In this case it would be unlikely the error is only triggered at shutdown.
  • You are using static_api_ptr_t<T> with a service T that has multiple factories by design.
eyebex
Thanks, the second seems to be the case. I'm using
  • static_api_ptr_t<playlist_manager>
  • static_api_ptr_t<play_callback_manager>
  • static_api_ptr_t<playback_control>
  • static_api_ptr_t<user_interface>
  • static_api_ptr_t<metadb_io_v2>
I'm properly unregistering the callback. Any idea which of these might be causing the issue and how to resolve it?
Frank Bicking
QUOTE
static_api_ptr_t<user_interface>

This is incorrect. user_interface is implemented to create your own UI module.

Use static_api_ptr_t<ui_control> to interact with the active user interface.

Please do also note that several methods should not be called from global callbacks:
QUOTE
//! Do not call playback_control methods from inside any kind of global callback (e.g. playlist callback), otherwise race conditions may occur.
class NOVTABLE playback_control : public service_base
QUOTE
//! WARNING: Methods that perform file access (tag reads/writes) run a modal message loop. They SHOULD NOT be called from global callbacks and such.
class NOVTABLE metadb_io : public service_base
eyebex
Thanks a lot. The reason why I was using user_interface was that is has a shutdown() method. What is the proper way to shutdown foobar then, as ui_control has no shutdown() method?
eyebex
I just found standard_commands::main_exit() which seems to work fine.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2008 Invision Power Services, Inc.