@@ -61,20 +61,14 @@ class closure_action
6161 deletable (b.deletable)
6262 {
6363 }
64- virtual void do_action () = 0;
64+ virtual void do_action ()
65+ {
66+ }
6567 bool deletable;
6668 private:
6769 friend class http_response ;
6870};
6971
70- class empty_closure : public closure_action
71- {
72- public:
73- void do_action ()
74- {
75- }
76- };
77-
7872class unlock_on_close : public closure_action
7973{
8074 public:
@@ -146,7 +140,7 @@ class http_response
146140 keepalive_secs (keepalive_secs),
147141 keepalive_msg (keepalive_msg),
148142 send_topic (send_topic),
149- ca (new empty_closure ())
143+ ca (new closure_action ())
150144 {
151145 set_header (http_utils::http_header_content_type, content_type);
152146 }
@@ -169,11 +163,10 @@ class http_response
169163 topics (b.topics),
170164 keepalive_secs (b.keepalive_secs),
171165 keepalive_msg (b.keepalive_msg),
172- send_topic (b.send_topic)
166+ send_topic (b.send_topic),
167+ ca (new closure_action())
173168 {
174- if (ca != 0x0 && ca->deletable )
175- delete ca;
176- ca = b.ca ;
169+ *ca = b.ca ;
177170 }
178171 http_response& operator =(const http_response& b)
179172 {
@@ -193,14 +186,20 @@ class http_response
193186 keepalive_msg = b.keepalive_msg ;
194187 send_topic = b.send_topic ;
195188 if (ca != 0x0 && ca->deletable )
189+ {
196190 delete ca;
191+ ca = 0x0 ;
192+ }
197193 ca = b.ca ;
198194 return *this ;
199195 }
200196 virtual ~http_response ()
201197 {
202198 if (ca != 0x0 && ca->deletable )
199+ {
203200 delete ca;
201+ ca = 0x0 ;
202+ }
204203 }
205204 /* *
206205 * Method used to get the content from the response.
0 commit comments