~alextee/zrythm

7f64601afd0f7d68dcb194273a13989bd3df5587 — Alexandros Theodotou 2 years ago a341925 gtk4
delete lane button widgets as part of lane free instead of track widget destroy

Fixes segfault on close
2 files changed, 9 insertions(+), 10 deletions(-)

M src/audio/track_lane.c
M src/gui/widgets/track.c
M src/audio/track_lane.c => src/audio/track_lane.c +9 -0
@@ 26,6 26,7 @@
#include "gui/backend/event.h"
#include "gui/backend/event_manager.h"
#include "gui/widgets/arranger.h"
#include "gui/widgets/custom_button.h"
#include "midilib/src/midifile.h"
#include "midilib/src/midiinfo.h"
#include "project.h"


@@ 467,5 468,13 @@ track_lane_free (

  object_zero_and_free_if_nonnull (self->regions);

  /* FIXME this is bad design - this object should
   * not care about widgets */
  for (int j = 0; j < self->num_buttons; j++)
    {
      if (self->buttons[j])
        custom_button_widget_free (self->buttons[j]);
    }

  object_zero_and_free (self);
}

M src/gui/widgets/track.c => src/gui/widgets/track.c +0 -10
@@ 3101,16 3101,6 @@ on_destroy (
      custom_button_widget_free (cb);
    }

  for (int i = 0; i < track->num_lanes; i++)
    {
      TrackLane * lane = track->lanes[i];
      for (int j = 0; j < lane->num_buttons; j++)
        {
          cb = lane->buttons[j];
          custom_button_widget_free (cb);
        }
    }

  track->widget = NULL;
}