Skip to content
This repository was archived by the owner on May 22, 2019. It is now read-only.

Commit c6991b7

Browse files
committed
fix race condition with theme heartbeat. finalize 2.1.4 release. updated translations.
1 parent 3d05358 commit c6991b7

File tree

6 files changed

+71
-36
lines changed

6 files changed

+71
-36
lines changed

NEWS

+5
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
Overview of changes in lightdm-webkit2-greeter 2.1.4
2+
3+
* Implemented a theme heartbeat to allow the greeter to detect and respond to theme failures.
4+
* Updated translations.
5+
16
Overview of changes in lightdm-webkit2-greeter 2.1.3
27

38
* Implemented work-around in default theme for webkit2gtk localStorage bug.

configure.ac

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
dnl Process this file with autoconf to produce a configure script.
22

3-
AC_INIT(lightdm-webkit2-greeter, 2.1.3)
3+
AC_INIT(lightdm-webkit2-greeter, 2.1.4)
44
AC_SUBST(THEME_DIR)
55
AC_CONFIG_HEADER(config.h)
66
AC_PREREQ([2.59])

src/lightdm-webkit2-greeter.c

+17-2
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ static int timeout, interval, prefer_blanking, allow_exposures;
6060

6161
static gint config_timeout;
6262

63-
static gboolean debug_mode, heartbeat;
63+
static gboolean debug_mode, heartbeat, heartbeat_exit;
6464

6565
static GdkFilterReturn
6666
wm_window_filter(GdkXEvent *gxevent, GdkEvent *event, gpointer data) {
@@ -130,7 +130,7 @@ context_menu_cb(WebKitWebView *view,
130130

131131
static gboolean
132132
check_theme_heartbeat_cb(void) {
133-
if (! heartbeat) {
133+
if (! heartbeat && ! heartbeat_exit) {
134134
/* Theme heartbeat not received. We assume that an error has occured
135135
* which broke script execution. We will fallback to the simple theme
136136
* so the user won't be stuck with a broken login screen.
@@ -161,10 +161,23 @@ theme_heartbeat_cb(void) {
161161
/* Setup g_timeout callback for theme heartbeat check */
162162
g_timeout_add_seconds(8, (GSourceFunc) check_theme_heartbeat_cb, NULL);
163163
heartbeat = TRUE;
164+
heartbeat_exit = FALSE;
164165
}
165166
}
166167

167168

169+
/**
170+
* Heartbeat exit callback.
171+
*
172+
* Before starting the user's session, themes should exit the heartbeat
173+
* to prevent a race condition while the greeter is shutting down.
174+
*/
175+
static void
176+
theme_heartbeat_exit_cb(void) {
177+
heartbeat_exit = TRUE;
178+
}
179+
180+
168181
/**
169182
* Lock Hint enabled handler.
170183
*
@@ -221,6 +234,8 @@ message_received_cb(WebKitUserContentManager *manager,
221234
lock_hint_enabled_handler();
222235
} else if (strcmp(message_str, "Heartbeat") == 0) {
223236
theme_heartbeat_cb();
237+
} else if (strcmp(message_str, "Heartbeat::Exit") == 0) {
238+
theme_heartbeat_exit_cb();
224239
}
225240

226241
g_free(message_str);

themes/antergos/i18n/bg.json

+9-9
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
{
2-
"auth_failed": "Uh Oh! Неуспешна идентификация. Моля, опитайте отново.",
3-
"background_options": "Опции Предистория",
2+
"auth_failed": "Опа! Неуспешна идентификация. Моля, опитайте отново.",
3+
"background_options": "Опции на фона",
44
"cancel": "Отказ",
55
"confirm_system_action": "Сигурен ли си?",
6-
"debug_log": "Debug Log",
7-
"greeting": "Добре дошла!",
8-
"hibernate": "спя зимен сън",
9-
"random": "произволен",
6+
"debug_log": "Лог за отстраняване на грешки",
7+
"greeting": "Добре дошли!",
8+
"hibernate": "Хибернация",
9+
"random": "Произволен",
1010
"reset": "Нулиране",
11-
"restart": "Рестарт",
12-
"shutdown": "Изключвам",
13-
"suspend": "Задържане"
11+
"restart": "Рестартиране",
12+
"shutdown": "Изключване",
13+
"suspend": "Преустановяване"
1414
}

themes/antergos/i18n/sr.json

+12-12
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
{
2-
"auth_failed": "Uh Oh! Аутхентицатион фаилед. Molim vas, pokušajte ponovo.",
3-
"background_options": "Бацкгроунд Опције",
4-
"cancel": "отказати",
5-
"confirm_system_action": "Da li si siguran?",
6-
"debug_log": "дебуг се",
7-
"greeting": "Dobrodošao!",
8-
"hibernate": "хибернирати",
9-
"random": "случајан",
10-
"reset": "Ресет",
11-
"restart": "Ponovo pokreni",
12-
"shutdown": "Isključi",
13-
"suspend": "суспендовати"
2+
"auth_failed": "Ahhh! Autentifikacija nepoznata. Molim Vas, pokušajte ponovo.",
3+
"background_options": "Opcije za pozadinu",
4+
"cancel": "Odustani",
5+
"confirm_system_action": "Da li ste sigurni?",
6+
"debug_log": "Debug log datoteka",
7+
"greeting": "Dobrodošli!",
8+
"hibernate": "Hibernacija",
9+
"random": "Slučajni odabir",
10+
"reset": "Resetovanje",
11+
"restart": "Ponovno pokretanje",
12+
"shutdown": "Isključivanje",
13+
"suspend": "Suspendovanje rada računara"
1414
}

themes/antergos/js/greeter.js

+27-12
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,13 @@ class AntergosThemeUtils {
8181
}
8282

8383

84+
/**
85+
* Initialize greeter theme heartbeat. Themes start the heartbeat by sending a post message
86+
* via JavaScript. Once started, the heartbeat will schedule a check to ensure that the
87+
* theme has sent a subsequent heartbeat message. Once started, if a heartbeat message was not
88+
* received by the time greeter's check runs it will assume that there has been an error
89+
* in the web process and fallback to the simple theme.
90+
*/
8491
initialize_theme_heartbeat() {
8592
var heartbeats = 0;
8693

@@ -95,6 +102,18 @@ class AntergosThemeUtils {
95102
}
96103

97104

105+
/**
106+
* Exits the heartbeat.
107+
*
108+
* Before starting the user's session, themes should exit the heartbeat
109+
* to prevent a race condition when the greeter is shutting down.
110+
*/
111+
stop_theme_heartbeat() {
112+
window.webkit.messageHandlers.GreeterBridge.postMessage('Heartbeat::Exit');
113+
clearInterval(this.heartbeat);
114+
}
115+
116+
98117
setup_cache_backend() {
99118
// Do we have access to localStorage?
100119
try {
@@ -264,7 +283,6 @@ class AntergosThemeUtils {
264283

265284

266285

267-
268286
/**
269287
* This class handles the theme's background switcher.
270288
*/
@@ -466,25 +484,15 @@ class AntergosTheme {
466484
* Initialize the theme.
467485
*/
468486
initialize() {
469-
_util.log('initialize() starting.');
470487
this.prepare_translations();
471-
_util.log('initialize() 1.');
472488
this.do_static_translations();
473-
_util.log('initialize() 2.');
474489
this.initialize_clock();
475-
_util.log('initialize() 3.');
476490
this.prepare_login_panel_header();
477-
_util.log('initialize() 4.');
478491
this.prepare_user_list();
479-
_util.log('initialize() 5.');
480492
this.prepare_session_list();
481-
_util.log('initialize() 6.');
482493
this.prepare_system_action_buttons();
483-
_util.log('initialize() 7.');
484494
this.register_callbacks();
485-
_util.log('initialize() 8.');
486495
this.background_manager.setup_background_thumbnails();
487-
_util.log('initialize() finished.');
488496
}
489497

490498

@@ -769,6 +777,9 @@ class AntergosTheme {
769777

770778
if ( lightdm.is_authenticated ) {
771779
// The user entered the correct password. Let's log them in.
780+
// But first, we need to exit the theme heartbeat to prevent a race condition.
781+
_util.stop_theme_heartbeat();
782+
772783
$( 'body' ).fadeOut( 1000, () => {
773784
lightdm.login( lightdm.authentication_user, selected_session );
774785
} );
@@ -823,6 +834,8 @@ class AntergosTheme {
823834

824835
$modal.find( '.btn-primary' ).text( _util.translations[ action ] ).click( action, ( event ) => {
825836
$( this ).off( 'click' );
837+
// Stop theme heartbeat to prevent race condition.
838+
_util.stop_theme_heartbeat();
826839
lightdm[ event.data ]();
827840
} );
828841
$modal.find( '.btn-default' ).click( () => {
@@ -883,11 +896,13 @@ class AntergosTheme {
883896
}
884897

885898

899+
900+
901+
886902
/**
887903
* Initialize the theme once the window has loaded.
888904
*/
889905
$( window ).load( () => {
890906
new AntergosThemeUtils();
891907
new AntergosTheme();
892908
} );
893-

0 commit comments

Comments
 (0)