mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 993737 - Only fire shutdown notifications on main thread. r=gsvelto
This commit is contained in:
parent
601a8e8e4e
commit
b4f7791261
@ -9,6 +9,7 @@
|
||||
#include <sys/reboot.h>
|
||||
#include "nsIObserverService.h"
|
||||
#include "mozilla/Services.h"
|
||||
#include "MainThreadUtils.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace hal_impl {
|
||||
@ -16,9 +17,11 @@ namespace hal_impl {
|
||||
void
|
||||
Reboot()
|
||||
{
|
||||
nsCOMPtr<nsIObserverService> obsServ = services::GetObserverService();
|
||||
if (obsServ) {
|
||||
obsServ->NotifyObservers(nullptr, "system-reboot", nullptr);
|
||||
if (NS_IsMainThread()) {
|
||||
nsCOMPtr<nsIObserverService> obsServ = services::GetObserverService();
|
||||
if (obsServ) {
|
||||
obsServ->NotifyObservers(nullptr, "system-reboot", nullptr);
|
||||
}
|
||||
}
|
||||
sync();
|
||||
reboot(RB_AUTOBOOT);
|
||||
@ -27,9 +30,11 @@ Reboot()
|
||||
void
|
||||
PowerOff()
|
||||
{
|
||||
nsCOMPtr<nsIObserverService> obsServ = services::GetObserverService();
|
||||
if (obsServ) {
|
||||
obsServ->NotifyObservers(nullptr, "system-power-off", nullptr);
|
||||
if (NS_IsMainThread()) {
|
||||
nsCOMPtr<nsIObserverService> obsServ = services::GetObserverService();
|
||||
if (obsServ) {
|
||||
obsServ->NotifyObservers(nullptr, "system-power-off", nullptr);
|
||||
}
|
||||
}
|
||||
sync();
|
||||
reboot(RB_POWER_OFF);
|
||||
|
Loading…
Reference in New Issue
Block a user