Hi there

On Sunday 21 September 2008 17:28:47 Jakob Lund wrote:
>
> If, during the shutdown process, the Instrument objects get deleted before
> the Hydrogen instance, that would cause such an invalid read (because I
> altered Sampler::stop_playing_notes() in a way that it accesses the
> instrument attached to each note, in order to update the instrument's
> reference count). I'll try looking into it later...
>  - Jakob Lund.

I looked at ~HydrogenApp, and in there the song gets deleted before the 
Hydrogen instance. But ~Song deletes its InstrumentList, which in turn deletes 
all the instruments, so the result, when ~Hydrogen calls 
Sampler::stop_playing_notes(), is an illegal read -- and the problematic 
assert statement (bug #36) then asserts something about a property of an 
instrument that has already been deleted.

I'm guessing here, because I haven't been able to reproduce this bug myself. 
The attached patch just switches the order of the `delete' operations. Please 
review.

 - Jakob Lund.

PS: I'm having a busy time here. I'm a father for the 3rd time (here we are 
http://www.imada.sdu.dk/~jlund05/) , and I started school too, so I have 
little time for hacking :-) . As a result, `my' branch of hydrogen is growing 
only veeery slowly -- but shiver me timbers, I'll get it rolling, eventually.

Index: gui/src/HydrogenApp.cpp
===================================================================
--- gui/src/HydrogenApp.cpp	(revision 497)
+++ gui/src/HydrogenApp.cpp	(working copy)
@@ -115,8 +115,9 @@
 
 	Hydrogen *engine = Hydrogen::get_instance();
 	if (engine) {
-		delete engine->getSong();
+		H2Core::Song * song = engine->getSong();
 		delete engine;
+		delete song;
 	}
 
 	#ifdef LADSPA_SUPPORT
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Hydrogen-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/hydrogen-devel

Reply via email to