diff options
author | André Stösel <andre@stoesel.de> | 2014-01-12 19:14:15 +0100 |
---|---|---|
committer | André Stösel <andre@stoesel.de> | 2014-01-12 19:14:15 +0100 |
commit | 699714619c6ee543e3a88cc81614004974f5e2f2 (patch) | |
tree | f7695f115f93f9a24326312d5e794c0070cc0b44 | |
parent | 0dada255ea3530fd15c1f8d16b4d3e9fe2a0a480 (diff) | |
download | midori-699714619c6ee543e3a88cc81614004974f5e2f2.tar.gz |
cache state of midori_app_get_crashed to avoid race conditions
-rw-r--r-- | midori/midori-app.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/midori/midori-app.c b/midori/midori-app.c index 7e3162e7..8d6d177c 100644 --- a/midori/midori-app.c +++ b/midori/midori-app.c @@ -615,6 +615,11 @@ midori_app_get_name (MidoriApp* app) gboolean midori_app_get_crashed (MidoriApp* app) { + static gint cache = -1; + + if (cache != -1) + return (gboolean) cache; + if (!midori_paths_is_readonly ()) { /* We test for the presence of a dummy file which is created once @@ -624,10 +629,14 @@ midori_app_get_crashed (MidoriApp* app) if (!crashed) g_file_set_contents (config_file, "RUNNING", -1, NULL); g_free (config_file); - if (crashed) + if (crashed) { + cache = 1; return TRUE; + } } + cache = 0; + return FALSE; } |