File tree Expand file tree Collapse file tree 4 files changed +24
-3
lines changed Expand file tree Collapse file tree 4 files changed +24
-3
lines changed Original file line number Diff line number Diff line change @@ -52,6 +52,13 @@ char *xpl_func_ptr(Xpl_status_variable_get callback)
5252 return ptr_cast.ptr ;
5353}
5454
55+
56+ static void exit_hook ()
57+ {
58+ google::protobuf::ShutdownProtobufLibrary ();
59+ }
60+
61+
5562/*
5663 Start the plugin: start webservers
5764
@@ -65,6 +72,13 @@ char *xpl_func_ptr(Xpl_status_variable_get callback)
6572 */
6673int xpl_plugin_init (MYSQL_PLUGIN p)
6774{
75+ static bool atexit_installed = false ;
76+ if (!atexit_installed)
77+ {
78+ atexit_installed = true ;
79+ atexit (exit_hook);
80+ }
81+
6882 xpl::Plugin_system_variables::clean_callbacks ();
6983
7084 xpl_init_performance_schema ();
Original file line number Diff line number Diff line change @@ -26,7 +26,7 @@ using namespace xpl;
2626
2727int xpl_before_server_shutdown (Server_state_param *param)
2828{
29- google::protobuf::ShutdownProtobufLibrary ();
29+ // google::protobuf::ShutdownProtobufLibrary();
3030
3131 return 0 ;
3232}
Original file line number Diff line number Diff line change 2121#include < string>
2222#include < iostream>
2323
24+ #include < boost/shared_ptr.hpp>
2425#include < gtest/gtest.h>
2526
2627#include " ngs/protocol/output_buffer.h"
@@ -32,12 +33,14 @@ namespace im
3233 const ngs::Pool_config default_pool_config = { 0 , 0 , BUFFER_PAGE_SIZE };
3334
3435 namespace tests {
36+ std::vector<boost::shared_ptr<Page> > page_del;
3537
3638 static void add_pages (Output_buffer &ob, const size_t no_of_pages, const size_t page_size)
3739 {
3840 for (size_t i = 0 ; i < no_of_pages; i++)
3941 {
40- ob.push_back (new Page (page_size));
42+ page_del.push_back (boost::shared_ptr<Page>(new Page (page_size)));
43+ ob.push_back (page_del.back ().get ());
4144 }
4245 }
4346
Original file line number Diff line number Diff line change 1616
1717#include < gtest/gtest.h>
1818#include < boost/scoped_ptr.hpp>
19+ #include < boost/shared_ptr.hpp>
1920#include < mysql/service_my_snprintf.h>
2021#include < limits>
2122#include < string>
@@ -43,11 +44,14 @@ typedef ngs::Page_pool Page_pool;
4344
4445const ngs::Pool_config default_pool_config = { 0 , 0 , BUFFER_PAGE_SIZE };
4546
47+ static std::vector<boost::shared_ptr<ngs::Page> > page_del;
48+
4649static void add_pages (Output_buffer *ob, const size_t no_of_pages, const size_t page_size)
4750{
4851 for (size_t i = 0 ; i < no_of_pages; i++)
4952 {
50- ngs::Resource<ngs::Page> page (new ngs::Page (page_size));
53+ page_del.push_back (boost::shared_ptr<ngs::Page>(new ngs::Page (page_size)));
54+ ngs::Resource<ngs::Page> page (page_del.back ().get ());
5155 ob->push_back (page);
5256 }
5357}
You can’t perform that action at this time.
0 commit comments