Fixes: NB#284949 - m & d app boosters are leaking FDs

RevBy: Dmitry Rozenshtein
pull/1/head
Alexey Shilov 14 years ago
parent bc80a26fca
commit a057885ea7

2
debian/changelog vendored

@ -1,6 +1,6 @@
applauncherd (2.0.4) unstable; urgency=low
*
* Fixes: NB#284949 - m & d app boosters are leaking FDs
-- Olli Leppanen <olli.leppanen@nokia.com> Mon, 3 Oct 2011 11:18:27 +0300

@ -14,6 +14,17 @@ struct sigaction EventHandler::m_oldSigAction;
EventHandler::EventHandler(Booster* parent, EventHandlerType type) : m_item(0), m_parent(parent), m_type(type)
{
m_sighupFd[0] = -1;
m_sighupFd[1] = -1;
}
EventHandler::~EventHandler()
{
if (m_sighupFd[0] != -1)
::close(m_sighupFd[0]);
if (m_sighupFd[1] != -1)
::close(m_sighupFd[1]);
}
void EventHandler::runEventLoop()

@ -25,7 +25,7 @@ public:
EventHandler(Booster* parent, EventHandlerType type);
//! \brief Destructor
virtual ~EventHandler() {}
virtual ~EventHandler();
void runEventLoop();

@ -133,7 +133,7 @@ void Booster::initialize(int initialArgc, char ** initialArgv, int newBoosterLau
// Run process as single instance if requested
if (m_appData->singleInstance())
{
{
// Check if instance is already running
SingleInstancePluginEntry * pluginEntry = singleInstance->pluginEntry();
if (pluginEntry)
@ -255,6 +255,14 @@ void Booster::sendDataToParent()
bool Booster::receiveDataFromInvoker(int socketFd)
{
// delete previous connection instance because booster can
// connect with several invokers due to single-instance feature
if (m_connection != NULL)
{
delete m_connection;
m_connection = NULL;
}
// Setup the conversation channel with the invoker.
m_connection = new Connection(socketFd);

@ -75,6 +75,21 @@ Connection::Connection(int socketFd, bool testMode) :
#endif
}
Connection::~Connection()
{
close();
for (int i = 0; i < IO_DESCRIPTOR_COUNT; i++)
{
if (m_io[i] != -1)
{
::close(m_io[i]);
m_io[i] = -1;
}
}
}
int Connection::getFd() const
{
return m_fd;

@ -52,6 +52,10 @@ public:
*/
explicit Connection(int socketFd, bool testMode = false);
//! Destructor
virtual ~Connection();
/*! \brief Accept connection.
* Accept a socket connection from the invoker.
* Stores security credentials of the connected

@ -281,8 +281,10 @@ extern "C"
}
if(fcntl(g_lockFd, F_SETLK, &fl) == -1)
{
close(g_lockFd);
return false;
}
return true;
}
@ -304,11 +306,13 @@ extern "C"
if (Window winId = windowIdForBinary(dpy, binaryName))
{
raiseWindow(dpy, winId);
XCloseDisplay(dpy);
return true;
}
else
{
std::cerr << "ERROR!!: Lock reserved but no window id for binary name found." << std::endl;
XCloseDisplay(dpy);
return false;
}
}

Loading…
Cancel
Save