Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
P
protobuf
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
protobuf
Commits
1a34c92e
Commit
1a34c92e
authored
Aug 06, 2009
by
kenton@google.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make sure GeneratedMessageFactory is deleted on shutdown.
parent
6be265a8
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
4 deletions
+16
-4
message.cc
src/google/protobuf/message.cc
+16
-4
No files found.
src/google/protobuf/message.cc
View file @
1a34c92e
...
...
@@ -38,6 +38,7 @@
#include <google/protobuf/message.h>
#include <google/protobuf/stubs/common.h>
#include <google/protobuf/stubs/once.h>
#include <google/protobuf/io/coded_stream.h>
#include <google/protobuf/io/zero_copy_stream_impl.h>
#include <google/protobuf/descriptor.pb.h>
...
...
@@ -210,14 +211,25 @@ class GeneratedMessageFactory : public MessageFactory {
hash_map
<
const
Descriptor
*
,
const
Message
*>
type_map_
;
};
GeneratedMessageFactory
*
generated_message_factory_
=
NULL
;
GOOGLE_PROTOBUF_DECLARE_ONCE
(
generated_message_factory_once_init_
);
void
ShutdownGeneratedMessageFactory
()
{
delete
generated_message_factory_
;
}
void
InitGeneratedMessageFactory
()
{
generated_message_factory_
=
new
GeneratedMessageFactory
;
internal
::
OnShutdown
(
&
ShutdownGeneratedMessageFactory
);
}
GeneratedMessageFactory
::
GeneratedMessageFactory
()
{}
GeneratedMessageFactory
::~
GeneratedMessageFactory
()
{}
GeneratedMessageFactory
*
GeneratedMessageFactory
::
singleton
()
{
// No need for thread-safety here because this will be called at static
// initialization time. (And GCC4 makes this thread-safe anyway.)
static
GeneratedMessageFactory
*
singleton
=
new
GeneratedMessageFactory
;
return
singleton
;
GoogleOnceInit
(
&
generated_message_factory_once_init_
,
&
InitGeneratedMessageFactory
);
return
generated_message_factory_
;
}
void
GeneratedMessageFactory
::
RegisterFile
(
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment