gnash-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Gnash-commit] [SCM] Gnash branch, master, updated. release_0_8_9_start-


From: Bastiaan Jacques
Subject: [Gnash-commit] [SCM] Gnash branch, master, updated. release_0_8_9_start-261-g1cc993c
Date: Sat, 12 Mar 2011 19:33:26 +0000

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Gnash".

The branch, master has been updated
       via  1cc993c2a0e20c29617ab3061df7ffedf95a496e (commit)
       via  c7b606b7c7a3a06e74c733b9b00fc92f6e5d4401 (commit)
       via  81aceca829c9ed2c56a35e1d09bf51bf4b610703 (commit)
      from  a6823517b15234c8f3b69587b9e4b1bfbf460424 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://git.savannah.gnu.org/cgit//commit/?id=1cc993c2a0e20c29617ab3061df7ffedf95a496e


commit 1cc993c2a0e20c29617ab3061df7ffedf95a496e
Author: Bastiaan Jacques <address@hidden>
Date:   Sat Mar 12 20:29:07 2011 +0100

    Fix null pointer dereference.

diff --git a/plugin/npapi/pluginScriptObject.cpp 
b/plugin/npapi/pluginScriptObject.cpp
index fa075e2..8b1b6d7 100644
--- a/plugin/npapi/pluginScriptObject.cpp
+++ b/plugin/npapi/pluginScriptObject.cpp
@@ -524,7 +524,7 @@ GnashPluginScriptObject::Invoke(NPObject */* npobj */, 
NPIdentifier name,
     if (it != _methods.end()) {
         // log_debug("FOUND Method \"%s\"!", NPN_UTF8FromIdentifier(name));
         NPInvokeFunctionPtr func = it->second;
-        return func(NULL, name, args, argCount, result);
+        return func(this, name, args, argCount, result);
     } else {
         log_error("Couldn't find Method \"%s\"", NPN_UTF8FromIdentifier(name));
     }

http://git.savannah.gnu.org/cgit//commit/?id=c7b606b7c7a3a06e74c733b9b00fc92f6e5d4401


commit c7b606b7c7a3a06e74c733b9b00fc92f6e5d4401
Author: Bastiaan Jacques <address@hidden>
Date:   Sat Mar 12 20:28:26 2011 +0100

    Make the file descriptor variables part of the instance. Fixes bug #32758.

diff --git a/plugin/npapi/pluginScriptObject.cpp 
b/plugin/npapi/pluginScriptObject.cpp
index 385db2f..fa075e2 100644
--- a/plugin/npapi/pluginScriptObject.cpp
+++ b/plugin/npapi/pluginScriptObject.cpp
@@ -75,16 +75,6 @@ static NPClass GnashPluginScriptObjectClass = {
     GnashPluginScriptObject::marshalConstruct
 };
 
-/// The HostFD is the file descriptor for the socket connection
-/// to the standalone player. This is used by this plugin when reading
-/// messages from the standalone player.
-static int hostfd = -1;
-
-/// The ControlFD is the file descriptor for the socket connection
-/// to the standalone player. This is used when writing to the
-/// standalone player from this plugin.
-static int controlfd = -1;
-
 void
 printNPVariant(const NPVariant *value)
 {
@@ -271,14 +261,14 @@ GnashPluginScriptObject::initializeIdentifiers()
 
 // Constructor
 GnashPluginScriptObject::GnashPluginScriptObject()
-    : _nppinstance (0)
+    : _nppinstance (0),
+      _controlfd(-1),
+      _hostfd(-1)
 {
 //    log_debug(__PRETTY_FUNCTION__);
     
     initializeIdentifiers();
     
-    _sockfds[READFD] = 0;
-    _sockfds[WRITEFD] = 0;
 }
 
 // Constructor
@@ -289,8 +279,6 @@ GnashPluginScriptObject::GnashPluginScriptObject(NPP npp)
     
     initializeIdentifiers();
 
-    _sockfds[READFD] = 0;
-    _sockfds[WRITEFD] = 0;
 }
 
 // Destructor
@@ -656,7 +644,7 @@ void
 GnashPluginScriptObject::setControlFD(int x)
 {
 //    log_debug("%s: %d", __FUNCTION__, x);
-    controlfd = x;              // FIXME: this should go away
+    _controlfd = x;              // FIXME: this should go away
 }
 
 int
@@ -664,14 +652,14 @@ GnashPluginScriptObject::getControlFD()
 {
 // log_debug("getControlFD: %d", controlfd);
 
-    return controlfd;
+    return _controlfd;
 };
 
 void
 GnashPluginScriptObject::setHostFD(int x)
 {
 //    log_debug("%s: %d", __FUNCTION__, x);
-    hostfd = x;              // FIXME: this should go away
+    _hostfd = x;              // FIXME: this should go away
 }
 
 int
@@ -679,7 +667,7 @@ GnashPluginScriptObject::getHostFD()
 {
 // log_debug("getControlFD: %d", controlfd);
 
-    return hostfd;
+    return _hostfd;
 };
 
 
@@ -687,7 +675,7 @@ GnashPluginScriptObject::getHostFD()
 int
 GnashPluginScriptObject::writePlayer(const std::string &data)
 {
-    return writePlayer(controlfd, data);
+    return writePlayer(_controlfd, data);
 }
 
 int
@@ -707,7 +695,7 @@ GnashPluginScriptObject::writePlayer(int fd, const 
std::string &data)
 std::string
 GnashPluginScriptObject::readPlayer()
 {
-    return readPlayer(hostfd);
+    return readPlayer(_hostfd);
 }
 
 std::string
diff --git a/plugin/npapi/pluginScriptObject.h 
b/plugin/npapi/pluginScriptObject.h
index 40013f6..928f0e3 100644
--- a/plugin/npapi/pluginScriptObject.h
+++ b/plugin/npapi/pluginScriptObject.h
@@ -120,10 +120,8 @@ public:
     GnashNPVariant GetVariable(const std::string &name);
 
 
-    int getReadFD()  { return _sockfds[READFD]; };
-    GIOChannel *getReadChannel()  { return _iochan[READFD]; };
-    int getWriteFD() { return _sockfds[WRITEFD]; };
-    GIOChannel *getWriteChannel() { return _iochan[WRITEFD]; };
+    int getReadFD()  { return _hostfd; };
+    int getWriteFD() { return _controlfd; };
 
     // Write to the standalone player over the control socket
     int writePlayer(const std::string &data);
@@ -165,10 +163,15 @@ private:
     std::map<NPIdentifier, GnashNPVariant> _properties;
     std::map<NPIdentifier, NPInvokeFunctionPtr> _methods;
     // 0 for reading, 1 for writing
-    int         _sockfds[2];
-    GIOChannel *_iochan[2];
-    // ID to watch the read channel from the player
-    int         _watchid;
+
+    /// The ControlFD is the file descriptor for the socket connection
+    /// to the standalone player. This is used when writing to the
+    /// standalone player from this plugin.
+    int _controlfd;
+    /// The HostFD is the file descriptor for the socket connection
+    /// to the standalone player. This is used by this plugin when reading
+    /// messages from the standalone player.
+    int _hostfd;
 };
 
 } // end of gnash namespace

http://git.savannah.gnu.org/cgit//commit/?id=81aceca829c9ed2c56a35e1d09bf51bf4b610703


commit 81aceca829c9ed2c56a35e1d09bf51bf4b610703
Author: Bastiaan Jacques <address@hidden>
Date:   Sat Mar 12 19:33:48 2011 +0100

    Remove dead and unused code.

diff --git a/plugin/npapi/pluginScriptObject.cpp 
b/plugin/npapi/pluginScriptObject.cpp
index 7366b4c..385db2f 100644
--- a/plugin/npapi/pluginScriptObject.cpp
+++ b/plugin/npapi/pluginScriptObject.cpp
@@ -297,8 +297,6 @@ GnashPluginScriptObject::GnashPluginScriptObject(NPP npp)
 GnashPluginScriptObject::~GnashPluginScriptObject() 
 {
 //    log_debug(__PRETTY_FUNCTION__);
-// Should be automatically shutdown by GIO
-//    closePipe();
 }
 
 // Marshal Functions
@@ -313,14 +311,7 @@ NPObject *
 GnashPluginScriptObject::marshalAllocate (NPP npp, NPClass */* aClass */)
 {
 //    log_debug(__PRETTY_FUNCTION__);
-#if 0
-    GnashPluginScriptObject *npobj = reinterpret_cast<GnashPluginScriptObject 
*>
-        (NPN_MemAlloc(sizeof(GnashPluginScriptObject)));
-    npobj->setInstance(npp);
-    return npobj;
-#else
     return new GnashPluginScriptObject(npp);
-#endif
 }
 
 
@@ -328,11 +319,7 @@ void
 GnashPluginScriptObject::marshalDeallocate (NPObject *npobj)
 {
 //    log_debug(__PRETTY_FUNCTION__);
-#if 0
-    NPN_MemFree(reinterpret_cast<void *>(npobj));
-#else
     delete (GnashPluginScriptObject *)npobj;
-#endif
 }
 
 void 
@@ -340,7 +327,6 @@ GnashPluginScriptObject::marshalInvalidate (NPObject */* 
npobj */)
 {
 //    log_debug(__PRETTY_FUNCTION__);
 
-//    gpso->Invalidate();
 }
 
 bool 
@@ -670,11 +656,6 @@ void
 GnashPluginScriptObject::setControlFD(int x)
 {
 //    log_debug("%s: %d", __FUNCTION__, x);
-#if 0
-    if (_iochan == 0) {
-        _iochan[WRITEFD] = g_io_channel_unix_new(x);
-    }
-#endif
     controlfd = x;              // FIXME: this should go away
 }
 
@@ -683,9 +664,6 @@ GnashPluginScriptObject::getControlFD()
 {
 // log_debug("getControlFD: %d", controlfd);
 
-#if 0
-    return g_io_channel_unix_get_fd (_iochan);
-#endif    
     return controlfd;
 };
 
@@ -693,11 +671,6 @@ void
 GnashPluginScriptObject::setHostFD(int x)
 {
 //    log_debug("%s: %d", __FUNCTION__, x);
-#if 0
-    if (_iochan == 0) {
-        _iochan[WRITEFD] = g_io_channel_unix_new(x);
-    }
-#endif
     hostfd = x;              // FIXME: this should go away
 }
 
@@ -706,9 +679,6 @@ GnashPluginScriptObject::getHostFD()
 {
 // log_debug("getControlFD: %d", controlfd);
 
-#if 0
-    return g_io_channel_unix_get_fd (_iochan);
-#endif    
     return hostfd;
 };
 
@@ -792,253 +762,7 @@ GnashPluginScriptObject::readPlayer(int fd)
 }
 
 
-// Close the socket
-bool
-GnashPluginScriptObject::closePipe(int fd)
-{
-//     log_debug(__FUNCTION__);
-    
-    if (fd > 0) {
-        // Send a Quit message to the player before closing the pipe.
-        std::vector<std::string> args;
-        std::string str = plugin::ExternalInterface::makeInvoke("Quit", args);
-        writePlayer(fd, str);
-    
-        ::shutdown(fd, SHUT_RDWR);
-        ::close(fd);
-    }
-
-    return true;
-}
-
-// Create a socket so we can talk to the player.
-bool
-GnashPluginScriptObject::createPipe()
-{
-    log_debug(__PRETTY_FUNCTION__);
-#if 0    
-    int p2c_pipe[2];
-    int c2p_pipe[2];
-    int p2c_controlpipe[2];
-
-    int ret = socketpair(AF_UNIX, SOCK_STREAM, 0, p2c_pipe);
-    if (ret == -1) {
-        gnash::log_error("ERROR: socketpair(p2c) failed: %s", strerror(errno));
-        return;
-    }
-    _streamfd = p2c_pipe[1];
-
-    ret = socketpair(AF_UNIX, SOCK_STREAM, 0, c2p_pipe);
-    if (ret == -1) {
-        gnash::log_error("ERROR: socketpair(c2p) failed: %s", strerror(errno));
-        return;
-    }
-
-    ret = socketpair(AF_UNIX, SOCK_STREAM, 0, p2c_controlpipe);
-    if (ret == -1) {
-        gnash::log_error("ERROR: socketpair(control) failed: %s", 
strerror(errno));
-        return;
-    }
-    _controlfd = p2c_controlpipe[1];
-#endif
-
-#if 0
-    if ((_sockfds[READFD] == 0) && (_sockfds[WRITEFD] == 0)) {
-        int ret = socketpair(AF_UNIX, SOCK_STREAM, 0, _sockfds);
-    
-        if (ret == 0) {
-            // Set up the Glib IO Channel for reading from the plugin
-//            log_debug("Read fd for socketpair is: %d", _sockfds[READFD]);
-            
-            _iochan[READFD]  = g_io_channel_unix_new(_sockfds[READFD]);
-            g_io_channel_set_close_on_unref(_iochan[READFD], true);
-            _watchid = g_io_add_watch(_iochan[READFD], 
-                                      (GIOCondition)(G_IO_IN|G_IO_HUP), 
-                                      (GIOFunc)handleInvokeWrapper, this);
-            
-            // Set up the Glib IO Channel for writing to the plugin
-//            log_debug("Write fd for socketpair is: %d", _sockfds[WRITEFD]);
-            _iochan[WRITEFD] = g_io_channel_unix_new(_sockfds[WRITEFD]);
-            g_io_channel_set_close_on_unref(_iochan[WRITEFD], true);
-            return true;
-        }
-    }
-#endif
-    
-#if 0
-    std::stringstream ss;
-    static int count = 0;
-    ss << "/tmp/gnash-" << getpid() << count++;
-
-    return createPipe(ss.str());
-#endif
-
-    return false;
-}
-
-#if 0
-bool
-GnashPluginScriptObject::createPipe(const std::string &name)
-{
-    log_debug(__PRETTY_FUNCTION__);
-
-    mode_t mode = S_IRUSR|S_IWUSR;
-    if (!name.empty()) {
-        int ret = mkfifo(name.c_str(), mode);
-        if (ret == 0) {
-            _sockfd = ::open(name.c_str(), O_RDWR|O_NONBLOCK, mode);
-            if (_sockfd < 0) {
-                log_error("Couldn't open the pipe: \"%s\"", strerror(errno));
-            }
-        } else {
-            log_error("Couldn't create fifo: s\n", strerror(errno));
-        }
-    }
-
-    _pipename = name;
-    
-    return false;
-}
-#endif
-
-
-// Close the socketpair
-bool
-GnashPluginScriptObject::closePipe()
-{
-//     log_debug(__FUNCTION__);
-
-    bool ret = closePipe(_sockfds[READFD]);
-    if (ret) {
-        ret = closePipe(_sockfds[WRITEFD]);
-    } else {
-        return false;
-    }
-
-    GError *error;
-    GIOStatus rstatus = g_io_channel_shutdown(_iochan[READFD], true, &error);
-    GIOStatus wstatus = g_io_channel_shutdown(_iochan[WRITEFD], true, &error);
-    if ((rstatus == G_IO_STATUS_NORMAL)
-        && (wstatus == G_IO_STATUS_NORMAL)) {
-        return true;
-    } else {
-        return false;
-    }
-
-    return false;
-}
-
-// Check the pipe to see if it's ready, ie... is gnash connected yet ?
-bool
-GnashPluginScriptObject::checkPipe()
-{
-    return checkPipe(_sockfds[WRITEFD]);
-}
-
-bool
-GnashPluginScriptObject::checkPipe(int fd)
-{
-//    log_debug(__PRETTY_FUNCTION__);
-    
-    fd_set fdset;
-        
-    if (fd > 2) {
-        FD_ZERO(&fdset);
-        FD_SET(fd, &fdset);
-       struct timeval tval;
-        tval.tv_sec = 0;
-        tval.tv_usec = 100;
-        errno = 0;
-        int ret = select(fd+1, &fdset, NULL, NULL, &tval);
-        if (ret == 0) {
-            log_debug ("The pipe for #fd %d timed out waiting to read", fd);
-            return false;
-        } else if (ret == 1) {
-            log_debug ("The pipe for #fd is ready", fd);
-            controlfd = fd;
-            return true;
-        } else {
-            log_error("The pipe has this error: %s", strerror(errno));
-        }
-    }
 
-    return false;
-}
-
-bool
-GnashPluginScriptObject::handleInvoke(GIOChannel *iochan, GIOCondition cond)
-{
-    log_debug(__PRETTY_FUNCTION__);
-    
-    if ( cond & G_IO_HUP ) {
-        log_debug("Player control channel hang up");
-        // Returning false here will cause the "watch" to be removed. This 
watch
-        // is the only reference held to the GIOChannel, so it will be
-        // destroyed. We must make sure we don't attempt to destroy it again.
-        _watchid = 0;
-        return false;
-    }
-
-    assert(cond & G_IO_IN);
-
-    log_debug("Checking player requests on fd #%d",
-              g_io_channel_unix_get_fd(iochan));
-
-    do {
-        GError* error=NULL;
-        gchar* request;
-        gsize requestSize=0;
-        GIOStatus status = g_io_channel_read_line(iochan, &request,
-                &requestSize, NULL, &error);
-
-        switch ( status ) {
-          case G_IO_STATUS_ERROR:
-                log_error("Error reading request line: %s", error->message);
-
-                g_error_free(error);
-                return false;
-            case G_IO_STATUS_EOF:
-                log_error("EOF (error: %s", error->message);
-                return false;
-            case G_IO_STATUS_AGAIN:
-                log_error("Read again(error: %s", error->message);
-                break;
-            case G_IO_STATUS_NORMAL:
-                // process request
-                log_debug("Normal read: %s" + std::string(request));
-                break;
-            default:
-                log_error("Abnormal status!");
-                return false;
-            
-        }
-
-        // process request..
-        processPlayerRequest(request, requestSize);
-        g_free(request);
-
-    } while (g_io_channel_get_buffer_condition(iochan) & G_IO_IN);
-
-    return true;
-}
-
-bool
-GnashPluginScriptObject::processPlayerRequest(gchar */* buf */, gsize /* len 
*/)
-{
-    log_debug(__PRETTY_FUNCTION__);
-
-    return false;
-}
-
-bool
-GnashPluginScriptObject::handleInvokeWrapper(GIOChannel *iochan,
-                                             GIOCondition cond,
-                                             GnashPluginScriptObject* plugin)
-{
-    log_debug(__PRETTY_FUNCTION__);
-    
-    return plugin->handleInvoke(iochan, cond);
-}
 
 } // end of gnash namespace
 
diff --git a/plugin/npapi/pluginScriptObject.h 
b/plugin/npapi/pluginScriptObject.h
index 9185a2c..40013f6 100644
--- a/plugin/npapi/pluginScriptObject.h
+++ b/plugin/npapi/pluginScriptObject.h
@@ -119,16 +119,6 @@ public:
     /// @return the value as returned by the standalone player
     GnashNPVariant GetVariable(const std::string &name);
 
-    // Create a socketpair so we can talk to the player.
-    bool createPipe();
-    
-    // Close the socket
-    bool closePipe();
-    bool closePipe(int fd);
-
-    // Check the pipe to see if it's ready, ie... is gnash connected yet ?
-    bool checkPipe();
-    bool checkPipe(int fd);
 
     int getReadFD()  { return _sockfds[READFD]; };
     GIOChannel *getReadChannel()  { return _iochan[READFD]; };
@@ -165,25 +155,7 @@ protected:
     bool Enumerate(NPIdentifier **identifier, uint32_t *count);
     bool Construct(const NPVariant *data, uint32_t argCount, NPVariant 
*result);
 
-    bool handleInvoke(GIOChannel *iochan, GIOCondition cond);
-    
-    /// Process a null-terminated request line
-    //
-    /// @param buf
-    ///          The single request.
-    ///   Caller is responsible for memory management, but give us
-    ///   permission to modify the string.
-    ///
-    /// @param len
-    ///          Lenght of buffer.
-    ///
-    /// @return true if the request was processed, false otherwise (bogus 
request..)
-    ///
-    bool processPlayerRequest(gchar* buf, gsize len);
 private:
-    static bool handleInvokeWrapper(GIOChannel* iochan, GIOCondition cond,
-                                     GnashPluginScriptObject* plugin);
-
     void initializeIdentifiers();
     void setInstance(NPP inst) { _nppinstance = inst; };
     

-----------------------------------------------------------------------

Summary of changes:
 plugin/npapi/pluginScriptObject.cpp |  308 +---------------------------------
 plugin/npapi/pluginScriptObject.h   |   47 ++----
 2 files changed, 21 insertions(+), 334 deletions(-)


hooks/post-receive
-- 
Gnash



reply via email to

[Prev in Thread] Current Thread [Next in Thread]