Sorry, I sent only the mail to strk.

I send it to mail-ling list.

2006-10-31 (火) の 09:02 +0100 に strk さんは書きました:

> > gnash cannot be started with GStreamer backend since the backend has an
> > infinite loop.
> > 
> > The compile time warning is:
> > sound_handler_gst.cpp: In member function 'virtual void
> > GST_sound_handler::stop_all_sounds()':
> > sound_handler_gst.cpp:608: warning: comparison of unsigned expression >=
> > 0 is always true
> > 
> > The attachment diff will fix the issue.
> 
> The attached diff would likely segfault. I applied it after
> also changing the body to use (i-1), does it sound right ?

Yes, you are right.  I am quite silly.
Now Gstreamer backend works fine.  Thank you very much.

And now, sound_handler_gst.cpp:169 is the same sentence, is that OK?
I guess that causes some memory leaks.  What about attachment diff?

Thank you,
Hiroyuki Ikezoe

Index: backend/sound_handler_gst.cpp
===================================================================
RCS file: /sources/gnash/gnash/backend/sound_handler_gst.cpp,v
retrieving revision 1.25
diff -d -u -p -r1.25 sound_handler_gst.cpp
--- backend/sound_handler_gst.cpp	31 Oct 2006 08:32:35 -0000	1.25
+++ backend/sound_handler_gst.cpp	1 Nov 2006 04:16:53 -0000
@@ -65,6 +65,9 @@ typedef struct
 
 	long loop_count;
 	
+	// signal id
+	guint handoff_signal_id;
+
 } gst_elements;
 
 
@@ -166,7 +169,7 @@ public:
 	~GST_sound_handler()
 	{
 
-		for (size_t i= m_sound_data.size(); i > 0; i--) { //Optimized
+		for (size_t i=0, e=m_sound_data.size(); i < e; ++i)  {
 			stop_sound(i);
 			delete_sound(i);
 		}
@@ -460,7 +463,7 @@ public:
 						"sizetype", 2, "can-activate-pull", FALSE, "signal-handoffs", TRUE,
 						"sizemax", BUFFER_SIZE, "num-buffers", numBuf, NULL);
 			// Setup the callback
-			g_signal_connect (gst_element->input, "handoff", G_CALLBACK (callback_handoff), gst_element);
+			gst_element->handoff_signal_id = g_signal_connect (gst_element->input, "handoff", G_CALLBACK (callback_handoff), gst_element);
 
 			// link data, decoder, audio* and adder
 			gst_element_link_many (gst_element->input,
@@ -494,7 +497,7 @@ public:
 						"sizetype", 2, "can-activate-pull", FALSE, "signal-handoffs", TRUE,
 						"sizemax", BUFFER_SIZE, "num-buffers", numBuf, NULL);
 			// Setup the callback
-			g_signal_connect (gst_element->input, "handoff", G_CALLBACK (callback_handoff), gst_element);
+			gst_element->handoff_signal_id = g_signal_connect (gst_element->input, "handoff", G_CALLBACK (callback_handoff), gst_element);
 
 /*	caps info:
       audio/x-raw-int
@@ -567,6 +570,8 @@ public:
 			// FIXME: This stops ALL sounds, not just the current.
 			if (gst_element_set_state (GST_ELEMENT (elements->bin), GST_STATE_NULL) != 1) continue;
 
+			// Disconnect signals
+			g_signal_handler_disconnect (elements->input, elements->handoff_signal_id);
 
 			// Unref/delete the elements
 			gst_object_unref (GST_OBJECT (elements->bin));
@@ -574,6 +579,7 @@ public:
 
 			// Delete the gst_element struct
 			// @@ we're deleting the elements from the start, so half-way of the loop we will be referring to undefined elements. Is this intended ? --strk;
+			delete elements;
 			sounddata->m_gst_elements.erase(sounddata->m_gst_elements.begin() + i);
 			--soundsPlaying;
 			stopped = true;
@@ -596,6 +602,8 @@ public:
 		if (sound_handle >= 0 && (unsigned int) sound_handle < m_sound_data.size())
 		{
 			delete[] m_sound_data[sound_handle]->data;
+			delete m_sound_data[sound_handle];
+			m_sound_data.erase (m_sound_data.begin() + sound_handle);
 		}
 
 	}
_______________________________________________
Gnash-dev mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/gnash-dev

Reply via email to