mirror of
https://gitlab.uni-freiburg.de/opensourcevdi/spice
synced 2025-12-31 02:41:52 +00:00
client: foreign-menu: pass "active" param when creating a ForeignMenu (#769020)
The default stays the same -- false.
A race could prevent setting ForeignMenu::_active correctly.
That happened when Application::on_app_activated was called before
_foriegn_menu was created. When foriegn_menu was created its
_active defaults to false, and that has not changed, until focus
was taken out and back in spice-client window.
This caused usbrdr to sometimes not auto-share devices, unless
the user switched focus to a different application and back to
spicec.
The fix updates ForiegnMenu::_active upon creation.
(cherry picked from commit fdcef17364)
This commit is contained in:
parent
7d8cc134bf
commit
df17a852fa
@ -594,7 +594,7 @@ int Application::run()
|
||||
|
||||
void Application::on_start_running()
|
||||
{
|
||||
_foreign_menu.reset(new ForeignMenu(this));
|
||||
_foreign_menu.reset(new ForeignMenu(this, _active));
|
||||
if (_enable_controller) {
|
||||
_controller.reset(new Controller(this));
|
||||
return;
|
||||
|
||||
@ -33,9 +33,9 @@
|
||||
#define PIPE_NAME "/tmp/SpiceForeignMenu-%lu.uds"
|
||||
#endif
|
||||
|
||||
ForeignMenu::ForeignMenu(ForeignMenuInterface *handler)
|
||||
ForeignMenu::ForeignMenu(ForeignMenuInterface *handler, bool active)
|
||||
: _handler (handler)
|
||||
, _active (false)
|
||||
, _active (active)
|
||||
, _refs (1)
|
||||
{
|
||||
char pipe_name[PIPE_NAME_MAX_LEN];
|
||||
|
||||
@ -38,7 +38,7 @@ public:
|
||||
|
||||
class ForeignMenu : public NamedPipe::ListenerInterface {
|
||||
public:
|
||||
ForeignMenu(ForeignMenuInterface *handler);
|
||||
ForeignMenu(ForeignMenuInterface *handler, bool active = false);
|
||||
virtual ~ForeignMenu();
|
||||
|
||||
ForeignMenu* ref() { _refs++; return this;}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user