gnash-dev
[Top][All Lists]
Advanced

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

Re: [Gnash-dev] dangerous use of global data


From: Bastiaan Jacques
Subject: Re: [Gnash-dev] dangerous use of global data
Date: Sun, 12 Nov 2006 15:37:58 +0100
User-agent: KMail/1.9.5

On Sunday 12 November 2006 07:26, Hiroyuki Ikezoe wrote:
> I get the following error.
>
> action_buffer.cpp:46: error: conversion from 'const
> gnash::SWF::SWFHandlers*' to non-scalar typ
> 'gnash::SWF::SWFHandlers' requested
> ../../server/swf/ASHandlers.h: In function 'void
> __static_initialization_and_destruction_0(int, int)':
> ../../server/swf/ASHandlers.h:268: error:
> 'gnash::SWF::SWFHandlers::~SWFHandlers()' is private
> action_buffer.cpp:46: error: within this context
>
>
> To make the destructor of SwFHandler public fixes the error, but I
> think it is not singleton-linke. I have no more idea about it.

I've solved the immediate compiler problem by making the singleton 
stack-allocated (and committed), hoping this won't show up as a leak.

Bastiaan

Index: server/swf/ASHandlers.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/swf/ASHandlers.cpp,v
retrieving revision 1.94
diff -p -u -r1.94 ASHandlers.cpp
--- server/swf/ASHandlers.cpp   11 Nov 2006 22:52:19 -0000      1.94
+++ server/swf/ASHandlers.cpp   12 Nov 2006 14:20:49 -0000
@@ -499,8 +499,8 @@ const SWFHandlers&
 SWFHandlers::instance()
 {
        // since it never goes out of scope the auto_ptr should be safe 
here..
-       static std::auto_ptr<SWFHandlers> _instance ( new 
SWFHandlers() );
-       return *_instance;
+       static const SWFHandlers instance;
+       return instance;
 }




reply via email to

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