Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

H2 crashes when adding a new layer and rubberband is on #474

Closed
thijz opened this issue Feb 9, 2017 · 4 comments
Closed

H2 crashes when adding a new layer and rubberband is on #474

thijz opened this issue Feb 9, 2017 · 4 comments

Comments

@thijz
Copy link
Member

thijz commented Feb 9, 2017

steps to reproduce:

  1. open a new song and disable rubberband
  2. goto Instrument tab > Layers
  3. click on the dropdown next to 'Main'
  4. select 'Add' and create a new layer called 'BASS', hit OK
  5. enable rubberband
  6. H2 crashes

running H2 with verbose output does not give me more info
all i get is 'segmentation fault (core dumped)'

@trebmuh
Copy link
Member

trebmuh commented Feb 27, 2017

confirmed from a fresh rebuild ff19658 on Debian stable Jessie

@xnakos
Copy link
Contributor

xnakos commented Mar 3, 2017

QuickCrash:

  1. Launch Hydrogen
  2. Layers -> Dropdown -> add -> OK
  3. Toggle Rubberband OFF
  4. Toggle Rubberband ON

Try this:

diff --git a/src/gui/src/InstrumentEditor/InstrumentEditor.cpp b/src/gui/src/InstrumentEditor/InstrumentEditor.cpp
index 0698f6f..46a62a1 100644
--- a/src/gui/src/InstrumentEditor/InstrumentEditor.cpp
+++ b/src/gui/src/InstrumentEditor/InstrumentEditor.cpp
@@ -1351,7 +1351,11 @@ void InstrumentEditor::rubberbandbpmchangeEvent()
                        assert( pInstr );
                        if ( pInstr ){
                                for ( int nLayer = 0; nLayer < MAX_LAYERS; nLayer++ ) {
+                    std::cout << "m_nSelectedComponent = " << m_nSelectedComponent << std::endl;
+                    assert(pInstr->get_component(m_nSelectedComponent));
+                    std::cout << "Assert was fine" << std::endl;
                                        InstrumentLayer *pLayer = pInstr->get_component(m_nSelectedComponent)->get_layer( nLayer );
+                    std::cout << "The above would crash" << std::endl;
                                        if ( pLayer ) {
                                                Sample *pSample = pLayer->get_sample();
                                                if ( pSample ) {

It should output this:

m_nSelectedComponent = 1
hydrogen: /home/xnakos/Projects/hydrogen/src/gui/src/InstrumentEditor/InstrumentEditor.cpp:1355: virtual void InstrumentEditor::rubberbandbpmchangeEvent(): Assertion `pInstr->get_component(m_nSelectedComponent)' failed.
Aborted (core dumped)

@jeremyz
Copy link
Member

jeremyz commented Sep 16, 2017

remember : gdb is your friend

#0  0x0000555555677778 in H2Core::InstrumentComponent::get_layer(int) (this=0x0, idx=0) at /home/jeyzu/usr/git/hydrogen/src/core/include/hydrogen/basics/instrument_component.h:109
#1  0x00005555556869e2 in InstrumentEditor::rubberbandbpmchangeEvent() (this=0x555555f5bb90) at /home/jeyzu/usr/git/hydrogen/src/gui/src/InstrumentEditor/InstrumentEditor.cpp:1387

this=0x0 call to H2Core::InstrumentComponent::get_layer(int)
component is null !!

@jeremyz
Copy link
Member

jeremyz commented Sep 16, 2017

27d664c

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants