[maemo-developers] gtkmozembed: why kill itself in destructor?

From: Marius Gedminas marius at pov.lt
Date: Wed Jan 14 18:43:38 EET 2009
On Wed, Jan 14, 2009 at 02:27:04PM +0200, Eero Tamminen wrote:
> ext Zhihai Wang wrote:
> > Deal all,
> > 
> > In EmbedPrivate.cpp,
> > 
> > EmbedPrivate::~EmbedPrivate()
> > {
> >   sWindowList->RemoveElement(this);
> >   sWidgetCount--;
> >   mNeedFav = PR_FALSE;
> >   if (mProgress)
> >     mProgress->Shutdown();
> >   if (mEventListener)
> >     mEventListener->Shutdown();
> >   mOwningWidget = nsnull;
> >   if (sWidgetCount) return;
> >   gboolean bval = FALSE;
> >   if (gtk_moz_embed_common_get_pref
> > (G_TYPE_BOOLEAN,"gtkmozembed.no_destroy_on_last_window", &bval) && bval)
> >     return;
> >   int pid = getpid();
> >   EmbedCommon::DeleteInstance();
> >   EmbedGlobalHistory::DeleteInstance();
> >   kill (pid, SIGUSR1);
> >   kill (pid, SIGKILL);
> > }
> > 
> > Why shall we kill pid in the end? Can't the program exit normally?
> 
> AFAIK it can be quite a bit faster.
> 
> Normal process exit goes through a lot of destructor code,
> freeing things that are anyway freed by the operating system
> when process terminates.  Browser is threaded, so maybe that
> the destructors use locking too...

That's what the _exit() function from <unistd.h> is for, isn't it?

Marius Gedminas
-- 
"Don't trust a statistic you haven't faked yourself."
	-- Seen in another posting by Markus Kuhn
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://lists.maemo.org/pipermail/maemo-developers/attachments/20090114/a7301982/attachment.pgp 
More information about the maemo-developers mailing list