[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gnash-commit] /srv/bzr/gnash/trunk r11936: Use a global quit flag to ha
From: |
Benjamin Wolsey |
Subject: |
[Gnash-commit] /srv/bzr/gnash/trunk r11936: Use a global quit flag to handle SIGTERM. Makes plugin exit (and standalone) |
Date: |
Thu, 11 Feb 2010 20:56:36 +0100 |
User-agent: |
Bazaar (2.0.3) |
------------------------------------------------------------
revno: 11936 [merge]
committer: Benjamin Wolsey <address@hidden>
branch nick: trunk
timestamp: Thu 2010-02-11 20:56:36 +0100
message:
Use a global quit flag to handle SIGTERM. Makes plugin exit (and standalone)
nicer, and means that shared memory is cleaned up properly.
modified:
gui/Player.cpp
gui/Player.h
gui/gnash.cpp
gui/gui.cpp
gui/gui.h
=== modified file 'gui/Player.cpp'
--- a/gui/Player.cpp 2010-02-01 16:30:21 +0000
+++ b/gui/Player.cpp 2010-02-11 19:50:37 +0000
@@ -64,12 +64,9 @@
using namespace gnash;
namespace {
-gnash::LogFile& dbglogfile = gnash::LogFile::getDefaultInstance();
+ gnash::LogFile& dbglogfile = gnash::LogFile::getDefaultInstance();
}
-/// @todo Shouldn't Player be in 'gnash' namespace ?
-
-/*static private*/
void
Player::setFlashVars(const std::string& varstr)
{
=== modified file 'gui/Player.h'
--- a/gui/Player.h 2010-02-01 06:52:16 +0000
+++ b/gui/Player.h 2010-02-11 19:50:37 +0000
@@ -24,19 +24,22 @@
#include "gnashconfig.h"
#endif
-#include "gnash.h" // needed for interface and fscommand callbacks
-#include "sound_handler.h" // for visibility of sound_handler destructor
-#include "MediaHandler.h" // for visibility of MediaHandler destructor
+#include "gnash.h"
+#include "sound_handler.h"
+#include "MediaHandler.h"
#include "gui.h"
-#include "movie_definition.h" // for visibility of movie_definition destructor
-#include "smart_ptr.h" // for intrusive_ptr holding of top-level movie
-#include "movie_root.h" // for Abstract callbacks
-#include "RunResources.h" // for passing handlers and other data to the core.
+#include "movie_definition.h"
+#include "smart_ptr.h"
+#include "movie_root.h"
+#include "RunResources.h"
#include <string>
#include <boost/shared_ptr.hpp>
#include <map>
+// Flag for signal handlers to allow Gnash to quit gracefully.
+extern bool globalQuit;
+
// Forward declarations
namespace gnash
{
=== modified file 'gui/gnash.cpp'
--- a/gui/gnash.cpp 2010-02-01 06:51:11 +0000
+++ b/gui/gnash.cpp 2010-02-11 19:50:37 +0000
@@ -22,6 +22,15 @@
#include "gnashconfig.h"
#endif
+#include <string>
+#include <iostream>
+#include <ios>
+#include <csignal>
+#include <boost/format.hpp>
+#ifdef ENABLE_NLS
+# include <clocale>
+#endif
+
#include "Player.h"
#include "log.h"
#include "rc.h" // for use of rcfile
@@ -47,14 +56,6 @@
# include "gst/gstversion.h"
#endif
-#include <string>
-#include <iostream>
-#include <ios>
-
-#ifdef ENABLE_NLS
-# include <clocale>
-#endif
-
#ifdef GUI_ALP
#include <alp/title.h>
#include <alp/menubar.h>
@@ -65,8 +66,6 @@
# define gnash_main main
#endif
-#include <boost/format.hpp> // For i18n-friendly cerr
-
using std::cerr;
using std::endl;
using std::cout;
@@ -460,10 +459,18 @@
}
+void
+quitGnash(int)
+{
+ globalQuit = true;
+}
int
gnash_main(int argc, char *argv[])
{
+
+ // Handle sigterm gracefully.
+ signal(SIGTERM, quitGnash);
std::ios::sync_with_stdio(false);
=== modified file 'gui/gui.cpp'
--- a/gui/gui.cpp 2010-02-01 06:56:31 +0000
+++ b/gui/gui.cpp 2010-02-11 19:50:37 +0000
@@ -77,6 +77,7 @@
//#define SKIP_RENDERING_IF_LATE 1
+bool globalQuit = false;
namespace gnash {
@@ -933,6 +934,8 @@
bool
Gui::advanceMovie()
{
+ if (globalQuit) quit();
+
if (isStopped()) return true;
if (!_started) start();
=== modified file 'gui/gui.h'
--- a/gui/gui.h 2010-02-01 06:56:31 +0000
+++ b/gui/gui.h 2010-02-11 19:50:37 +0000
@@ -69,6 +69,12 @@
class movie_definition;
}
+/// Quit flag for C signal handlers.
+//
+/// If set to true, Gnash will exit at the next opportunity.
+/// This is not part of any API.
+extern bool globalQuit;
+
namespace gnash {
/// Enumerates mouse cursor types.
@@ -78,6 +84,7 @@
CURSOR_INPUT
};
+
/// Handles screen dumps.
class ScreenShotter
{
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Gnash-commit] /srv/bzr/gnash/trunk r11936: Use a global quit flag to handle SIGTERM. Makes plugin exit (and standalone),
Benjamin Wolsey <=