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

0.12 crashes on many files #7

Closed
jbeich opened this issue Nov 20, 2019 · 3 comments
Closed

0.12 crashes on many files #7

jbeich opened this issue Nov 20, 2019 · 3 comments

Comments

@jbeich
Copy link
Contributor

jbeich commented Nov 20, 2019

Regressed by aa72b16, reverting which makes the GUI work again.

$ cc --version
FreeBSD clang version 8.0.1 (tags/RELEASE_801/final 366581) (based on LLVM 8.0.1)
Target: x86_64-unknown-freebsd12.1
Thread model: posix
InstalledDir: /usr/bin

$ pkg info -d wavbreaker
wavbreaker-0.12:
        pango-1.42.4_3
        gtk3-3.24.10_1
        gtk-update-icon-cache-2.24.32
        gdk-pixbuf2-2.38.1
        cairo-1.16.0,2
        glib-2.56.3_6,1
        gettext-runtime-0.20.1
        desktop-file-utils-0.23
        mpg123-1.25.13
        moodbar-1.1_2
        libao-1.2.0_4
        atk-2.28.1

$ wavgen
wav_gen_2ch_44100hz_16bit.wav ... OK
wav_gen_2ch_44100hz_8bit.wav ... OK
wav_gen_1ch_44100hz_16bit.wav ... OK
wav_gen_1ch_44100hz_8bit.wav ... OK
wav_gen_1ch_22050hz_8bit.wav ... OK
wav_gen_1ch_11025hz_8bit.wav ... OK
wav_oneliner_1ch_8000hz_8bit.wav ... OK
wav_gen_long_2ch_44100hz_16bit.wav ... OK
$ wavbreaker wav_gen_1ch_11025hz_8bit.wav
Segmentation fault

* thread #1, name = 'wavbreaker', stop reason = signal SIGSEGV: invalid address (fault address: 0x8)
    frame #0: 0x0000000000210017 wavbreaker`draw_summary_surface(self=0x0000000803232de0, ctx=0x00007fffffff9230) at draw.c:363:16
   360          y_max = xaxis - y_max / scale;
   361
   362          /* find the track break we are drawing now */
-> 363          while (tbl->next && array_offset > ((TrackBreak *)(tbl->next->data))->offset) {
   364              tbl = tbl->next;
   365              ++tb_index;
   366          }
(lldb) print *ctx
(WaveformSurfaceDrawContext) $0 = {
  widget = 0x000000080250c210
  pixmap_offset = 0
  track_break_list = 0x0000000000000000
  graphData = 0x00000000002285a0
  moodbarData = 0x0000000000000000
}
(lldb) thread backtrace all
* thread #1, name = 'wavbreaker', stop reason = signal SIGSEGV: invalid address (fault address: 0x8)
  * frame #0: 0x0000000000210017 wavbreaker`draw_summary_surface(self=0x0000000803232de0, ctx=0x00007fffffff9230) at draw.c:363:16
    frame #1: 0x000000000021044d wavbreaker`waveform_surface_draw(surface=0x0000000803232de0, ctx=0x00007fffffff9230) at draw.c:121:5
    frame #2: 0x00000000002205e3 wavbreaker`draw_summary_configure_event(widget=0x000000080250c210, event=0x00000008033e0720, user_data=0x0000000000000000) at wavbreaker.c:1767:5
    frame #3: 0x0000000800c8c061 libgtk-3.so.0`_gtk_marshal_BOOLEAN__BOXED(closure=0x000000080351d3c0, return_value=0x00007fffffff94d8, n_param_values=2, param_values=0x00007fffffff9580, invocation_hint=0x00007fffffff9520, marshal_data=0x0000000000000000) at gtkmarshalers.c:83:14
    frame #4: 0x0000000801209009 libgobject-2.0.so.0`g_closure_invoke(closure=0x000000080351d3c0, return_value=0x00007fffffff94d8, n_param_values=2, param_values=0x00007fffffff9580, invocation_hint=0x00007fffffff9520) at gclosure.c:804:7
    frame #5: 0x0000000801228fc3 libgobject-2.0.so.0`signal_emit_unlocked_R(node=0x00000008025c89e0, detail=0, instance=0x000000080250c210, emission_return=0x00007fffffff9908, instance_and_params=0x00007fffffff9580) at gsignal.c:3635:8
    frame #6: 0x000000080122aa03 libgobject-2.0.so.0`g_signal_emit_valist(instance=0x000000080250c210, signal_id=102, detail=0, var_args=0x00007fffffff9cb0) at gsignal.c:3401:7
    frame #7: 0x000000080122b1a3 libgobject-2.0.so.0`g_signal_emit(instance=0x000000080250c210, signal_id=102, detail=0) at gsignal.c:3447:3
    frame #8: 0x0000000800c100df libgtk-3.so.0`gtk_widget_event_internal(widget=0x000000080250c210, event=0x00000008033e0720) at gtkwidget.c:7789:4
    frame #9: 0x0000000800c0fda4 libgtk-3.so.0`gtk_widget_event(widget=0x000000080250c210, event=0x00000008033e0720) at gtkwidget.c:7359:10
    frame #10: 0x0000000800916823 libgtk-3.so.0`gtk_drawing_area_send_configure(darea=0x000000080250c210) at gtkdrawingarea.c:264:3
    frame #11: 0x00000008009166e7 libgtk-3.so.0`gtk_drawing_area_size_allocate(widget=0x000000080250c210, allocation=0x00007fffffff9fc8) at gtkdrawingarea.c:243:7
    frame #12: 0x0000000800c0cc04 libgtk-3.so.0`gtk_widget_size_allocate_with_baseline(widget=0x000000080250c210, allocation=0x00007fffffffa078, baseline=-1) at gtkwidget.c:6172:5
    frame #13: 0x0000000800c0d552 libgtk-3.so.0`gtk_widget_size_allocate(widget=0x000000080250c210, allocation=0x00007fffffffa078) at gtkwidget.c:6253:3
    frame #14: 0x000000080098f349 libgtk-3.so.0`gtk_frame_allocate_border(gadget=0x0000000803363770, allocation=0x00007fffffffa1c8, baseline=-1, out_clip=0x00007fffffffa1a8, data=0x0000000000000000) at gtkframe.c:887:5
    frame #15: 0x00000008008cc517 libgtk-3.so.0`gtk_css_custom_gadget_allocate(gadget=0x0000000803363770, allocation=0x00007fffffffa1c8, baseline=-1, out_clip=0x00007fffffffa1a8) at gtkcsscustomgadget.c:143:12
    frame #16: 0x00000008008d296a libgtk-3.so.0`gtk_css_gadget_allocate(gadget=0x0000000803363770, allocation=0x00007fffffffa258, baseline=-1, out_clip=0x00007fffffffa248) at gtkcssgadget.c:790:3
    frame #17: 0x000000080098eeb6 libgtk-3.so.0`gtk_frame_allocate(gadget=0x00000008033648f0, allocation=0x00007fffffffa3b8, baseline=-1, out_clip=0x00007fffffffa398, data=0x0000000000000000) at gtkframe.c:850:3
    frame #18: 0x00000008008cc517 libgtk-3.so.0`gtk_css_custom_gadget_allocate(gadget=0x00000008033648f0, allocation=0x00007fffffffa3b8, baseline=-1, out_clip=0x00007fffffffa398) at gtkcsscustomgadget.c:143:12
    frame #19: 0x00000008008d296a libgtk-3.so.0`gtk_css_gadget_allocate(gadget=0x00000008033648f0, allocation=0x00007fffffffa5c8, baseline=-1, out_clip=0x00007fffffffa408) at gtkcssgadget.c:790:3
    frame #20: 0x000000080098e5e2 libgtk-3.so.0`gtk_frame_size_allocate(widget=0x00000008035271a0, allocation=0x00007fffffffa5c8) at gtkframe.c:788:3
    frame #21: 0x0000000800c0cc04 libgtk-3.so.0`gtk_widget_size_allocate_with_baseline(widget=0x00000008035271a0, allocation=0x00007fffffffa788, baseline=-1) at gtkwidget.c:6172:5
    frame #22: 0x0000000800c0d552 libgtk-3.so.0`gtk_widget_size_allocate(widget=0x00000008035271a0, allocation=0x00007fffffffa788) at gtkwidget.c:6253:3
    frame #23: 0x0000000800a609f5 libgtk-3.so.0`gtk_paned_child_allocate(child=0x00000008035271a0, child_window=0x00000008039e5640, window_allocation=0x00007fffffffa778, child_allocation=0x00007fffffffa788) at gtkpaned.c:1344:3
    frame #24: 0x0000000800a5f246 libgtk-3.so.0`gtk_paned_allocate(gadget=0x0000000803364970, allocation=0x00007fffffffa8e8, baseline=-1, out_clip=0x00007fffffffa8c8, data=0x0000000000000000) at gtkpaned.c:1548:11
    frame #25: 0x00000008008cc517 libgtk-3.so.0`gtk_css_custom_gadget_allocate(gadget=0x0000000803364970, allocation=0x00007fffffffa8e8, baseline=-1, out_clip=0x00007fffffffa8c8) at gtkcsscustomgadget.c:143:12
    frame #26: 0x00000008008d296a libgtk-3.so.0`gtk_css_gadget_allocate(gadget=0x0000000803364970, allocation=0x00007fffffffab08, baseline=-1, out_clip=0x00007fffffffa948) at gtkcssgadget.c:790:3
    frame #27: 0x0000000800a5bc62 libgtk-3.so.0`gtk_paned_size_allocate(widget=0x00000008034db810, allocation=0x00007fffffffab08) at gtkpaned.c:1357:3
    frame #28: 0x0000000800c0cc04 libgtk-3.so.0`gtk_widget_size_allocate_with_baseline(widget=0x00000008034db810, allocation=0x00007fffffffaca8, baseline=-1) at gtkwidget.c:6172:5
    frame #29: 0x000000080084e6bf libgtk-3.so.0`gtk_box_size_allocate_no_center(widget=0x000000080350cdf0, allocation=0x00007fffffffae68) at gtkbox.c:817:4
    frame #30: 0x000000080084ac8f libgtk-3.so.0`gtk_box_allocate_contents(gadget=0x00000008033636f0, allocation=0x00007fffffffae68, baseline=-1, out_clip=0x00007fffffffae48, unused=0x0000000000000000) at gtkbox.c:1211:5
    frame #31: 0x00000008008cc517 libgtk-3.so.0`gtk_css_custom_gadget_allocate(gadget=0x00000008033636f0, allocation=0x00007fffffffae68, baseline=-1, out_clip=0x00007fffffffae48) at gtkcsscustomgadget.c:143:12
    frame #32: 0x00000008008d296a libgtk-3.so.0`gtk_css_gadget_allocate(gadget=0x00000008033636f0, allocation=0x00007fffffffb078, baseline=-1, out_clip=0x00007fffffffaeb8) at gtkcssgadget.c:790:3
    frame #33: 0x0000000800849dca libgtk-3.so.0`gtk_box_size_allocate(widget=0x000000080350cdf0, allocation=0x00007fffffffb078) at gtkbox.c:1225:3
    frame #34: 0x0000000800c0cc04 libgtk-3.so.0`gtk_widget_size_allocate_with_baseline(widget=0x000000080350cdf0, allocation=0x00007fffffffb238, baseline=-1) at gtkwidget.c:6172:5
    frame #35: 0x0000000800c0d552 libgtk-3.so.0`gtk_widget_size_allocate(widget=0x000000080350cdf0, allocation=0x00007fffffffb238) at gtkwidget.c:6253:3
    frame #36: 0x0000000800a609f5 libgtk-3.so.0`gtk_paned_child_allocate(child=0x000000080350cdf0, child_window=0x00000008039e5190, window_allocation=0x00007fffffffb228, child_allocation=0x00007fffffffb238) at gtkpaned.c:1344:3
    frame #37: 0x0000000800a5f21e libgtk-3.so.0`gtk_paned_allocate(gadget=0x0000000803363570, allocation=0x00007fffffffb398, baseline=-1, out_clip=0x00007fffffffb378, data=0x0000000000000000) at gtkpaned.c:1541:11
    frame #38: 0x00000008008cc517 libgtk-3.so.0`gtk_css_custom_gadget_allocate(gadget=0x0000000803363570, allocation=0x00007fffffffb398, baseline=-1, out_clip=0x00007fffffffb378) at gtkcsscustomgadget.c:143:12
    frame #39: 0x00000008008d296a libgtk-3.so.0`gtk_css_gadget_allocate(gadget=0x0000000803363570, allocation=0x00007fffffffb5b8, baseline=-1, out_clip=0x00007fffffffb3f8) at gtkcssgadget.c:790:3
    frame #40: 0x0000000800a5bc62 libgtk-3.so.0`gtk_paned_size_allocate(widget=0x00000008034db630, allocation=0x00007fffffffb5b8) at gtkpaned.c:1357:3
    frame #41: 0x0000000800c0cc04 libgtk-3.so.0`gtk_widget_size_allocate_with_baseline(widget=0x00000008034db630, allocation=0x00007fffffffb748, baseline=-1) at gtkwidget.c:6172:5
    frame #42: 0x000000080084e6bf libgtk-3.so.0`gtk_box_size_allocate_no_center(widget=0x000000080350cb30, allocation=0x00007fffffffb908) at gtkbox.c:817:4
    frame #43: 0x000000080084ac8f libgtk-3.so.0`gtk_box_allocate_contents(gadget=0x00000008033631f0, allocation=0x00007fffffffb908, baseline=-1, out_clip=0x00007fffffffb8e8, unused=0x0000000000000000) at gtkbox.c:1211:5
    frame #44: 0x00000008008cc517 libgtk-3.so.0`gtk_css_custom_gadget_allocate(gadget=0x00000008033631f0, allocation=0x00007fffffffb908, baseline=-1, out_clip=0x00007fffffffb8e8) at gtkcsscustomgadget.c:143:12
    frame #45: 0x00000008008d296a libgtk-3.so.0`gtk_css_gadget_allocate(gadget=0x00000008033631f0, allocation=0x00007fffffffc5f8, baseline=-1, out_clip=0x00007fffffffb958) at gtkcssgadget.c:790:3
    frame #46: 0x0000000800849dca libgtk-3.so.0`gtk_box_size_allocate(widget=0x000000080350cb30, allocation=0x00007fffffffc5f8) at gtkbox.c:1225:3
    frame #47: 0x000000080120ecd8 libgobject-2.0.so.0`g_cclosure_marshal_VOID__BOXED(closure=0x0000000802579e20, return_value=0x0000000000000000, n_param_values=2, param_values=0x00007fffffffbcf0, invocation_hint=0x00007fffffffbc90, marshal_data=0x0000000800849d60) at gmarshal.c:1910:3
    frame #48: 0x0000000801209ae5 libgobject-2.0.so.0`g_type_class_meta_marshal(closure=0x0000000802579e20, return_value=0x0000000000000000, n_param_values=2, param_values=0x00007fffffffbcf0, invocation_hint=0x00007fffffffbc90, marshal_data=0x00000000000000d8) at gclosure.c:997:5
    frame #49: 0x0000000801209009 libgobject-2.0.so.0`g_closure_invoke(closure=0x0000000802579e20, return_value=0x0000000000000000, n_param_values=2, param_values=0x00007fffffffbcf0, invocation_hint=0x00007fffffffbc90) at gclosure.c:804:7
    frame #50: 0x0000000801228c8e libgobject-2.0.so.0`signal_emit_unlocked_R(node=0x00000008025c7b40, detail=0, instance=0x000000080350cb30, emission_return=0x0000000000000000, instance_and_params=0x00007fffffffbcf0) at gsignal.c:3565:7
    frame #51: 0x000000080122a96f libgobject-2.0.so.0`g_signal_emit_valist(instance=0x000000080350cb30, signal_id=72, detail=0, var_args=0x00007fffffffc420) at gsignal.c:3391:5
    frame #52: 0x000000080122b1a3 libgobject-2.0.so.0`g_signal_emit(instance=0x000000080350cb30, signal_id=72, detail=0) at gsignal.c:3447:3
    frame #53: 0x0000000800c0cbe1 libgtk-3.so.0`gtk_widget_size_allocate_with_baseline(widget=0x000000080350cb30, allocation=0x00007fffffffc688, baseline=-1) at gtkwidget.c:6170:5
    frame #54: 0x0000000800c0d552 libgtk-3.so.0`gtk_widget_size_allocate(widget=0x000000080350cb30, allocation=0x00007fffffffc688) at gtkwidget.c:6253:3
    frame #55: 0x0000000800c3fe51 libgtk-3.so.0`gtk_window_size_allocate(widget=0x00000008034b82a0, allocation=0x00007fffffffd388) at gtkwindow.c:7917:5
    frame #56: 0x0000000800836484 libgtk-3.so.0`gtk_application_window_real_size_allocate(widget=0x00000008034b82a0, allocation=0x00007fffffffd388) at gtkapplicationwindow.c:664:5
    frame #57: 0x000000080120ecd8 libgobject-2.0.so.0`g_cclosure_marshal_VOID__BOXED(closure=0x0000000802579e20, return_value=0x0000000000000000, n_param_values=2, param_values=0x00007fffffffca80, invocation_hint=0x00007fffffffca20, marshal_data=0x0000000800836380) at gmarshal.c:1910:3
    frame #58: 0x0000000801209ae5 libgobject-2.0.so.0`g_type_class_meta_marshal(closure=0x0000000802579e20, return_value=0x0000000000000000, n_param_values=2, param_values=0x00007fffffffca80, invocation_hint=0x00007fffffffca20, marshal_data=0x00000000000000d8) at gclosure.c:997:5
    frame #59: 0x0000000801209009 libgobject-2.0.so.0`g_closure_invoke(closure=0x0000000802579e20, return_value=0x0000000000000000, n_param_values=2, param_values=0x00007fffffffca80, invocation_hint=0x00007fffffffca20) at gclosure.c:804:7
    frame #60: 0x0000000801228c8e libgobject-2.0.so.0`signal_emit_unlocked_R(node=0x00000008025c7b40, detail=0, instance=0x00000008034b82a0, emission_return=0x0000000000000000, instance_and_params=0x00007fffffffca80) at gsignal.c:3565:7
    frame #61: 0x000000080122a96f libgobject-2.0.so.0`g_signal_emit_valist(instance=0x00000008034b82a0, signal_id=72, detail=0, var_args=0x00007fffffffd1b0) at gsignal.c:3391:5
    frame #62: 0x000000080122b1a3 libgobject-2.0.so.0`g_signal_emit(instance=0x00000008034b82a0, signal_id=72, detail=0) at gsignal.c:3447:3
    frame #63: 0x0000000800c0cbe1 libgtk-3.so.0`gtk_widget_size_allocate_with_baseline(widget=0x00000008034b82a0, allocation=0x00007fffffffd468, baseline=-1) at gtkwidget.c:6170:5
    frame #64: 0x0000000800c0d552 libgtk-3.so.0`gtk_widget_size_allocate(widget=0x00000008034b82a0, allocation=0x00007fffffffd468) at gtkwidget.c:6253:3
    frame #65: 0x0000000800c35f22 libgtk-3.so.0`gtk_window_move_resize(window=0x00000008034b82a0) at gtkwindow.c:10009:7
    frame #66: 0x0000000800c416c6 libgtk-3.so.0`gtk_window_check_resize(container=0x00000008034b82a0) at gtkwindow.c:8566:5
    frame #67: 0x000000080120cd60 libgobject-2.0.so.0`g_cclosure_marshal_VOID__VOIDv(closure=0x00000008032200a0, return_value=0x0000000000000000, instance=0x00000008034b82a0, args=0x00007fffffffde50, marshal_data=0x0000000800c41640, n_params=0, param_types=0x0000000000000000) at gmarshal.c:905:3
    frame #68: 0x0000000801209ed2 libgobject-2.0.so.0`g_type_class_meta_marshalv(closure=0x00000008032200a0, return_value=0x0000000000000000, instance=0x00000008034b82a0, args=0x00007fffffffde50, marshal_data=0x0000000000000348, n_params=0, param_types=0x0000000000000000) at gclosure.c:1024:5
    frame #69: 0x00000008012093fb libgobject-2.0.so.0`_g_closure_invoke_va(closure=0x00000008032200a0, return_value=0x0000000000000000, instance=0x00000008034b82a0, args=0x00007fffffffde50, n_params=0, param_types=0x0000000000000000) at gclosure.c:867:7
    frame #70: 0x0000000801229bc5 libgobject-2.0.so.0`g_signal_emit_valist(instance=0x00000008034b82a0, signal_id=136, detail=0, var_args=0x00007fffffffde50) at gsignal.c:3300:8
    frame #71: 0x000000080122b1a3 libgobject-2.0.so.0`g_signal_emit(instance=0x00000008034b82a0, signal_id=136, detail=0) at gsignal.c:3447:3
    frame #72: 0x00000008008beca6 libgtk-3.so.0`gtk_container_check_resize(container=0x00000008034b82a0) at gtkcontainer.c:2175:3
    frame #73: 0x00000008008c3fd0 libgtk-3.so.0`gtk_container_idle_sizer(clock=0x000000080252d300, container=0x00000008034b82a0) at gtkcontainer.c:2065:7
    frame #74: 0x000000080120cd60 libgobject-2.0.so.0`g_cclosure_marshal_VOID__VOIDv(closure=0x00000008036802c0, return_value=0x0000000000000000, instance=0x000000080252d300, args=0x00007fffffffe770, marshal_data=0x0000000000000000, n_params=0, param_types=0x0000000000000000) at gmarshal.c:905:3
    frame #75: 0x00000008012093fb libgobject-2.0.so.0`_g_closure_invoke_va(closure=0x00000008036802c0, return_value=0x0000000000000000, instance=0x000000080252d300, args=0x00007fffffffe770, n_params=0, param_types=0x0000000000000000) at gclosure.c:867:7
    frame #76: 0x0000000801229bc5 libgobject-2.0.so.0`g_signal_emit_valist(instance=0x000000080252d300, signal_id=54, detail=0, var_args=0x00007fffffffe770) at gsignal.c:3300:8
    frame #77: 0x000000080122b1a3 libgobject-2.0.so.0`g_signal_emit(instance=0x000000080252d300, signal_id=54, detail=0) at gsignal.c:3447:3
    frame #78: 0x0000000800d5ff8f libgdk-3.so.0`_gdk_frame_clock_emit_layout(frame_clock=0x000000080252d300) at gdkframeclock.c:637:3
    frame #79: 0x0000000800d61434 libgdk-3.so.0`gdk_frame_clock_paint_idle(data=0x000000080252d300) at gdkframeclockidle.c:428:19
    frame #80: 0x0000000800d3de17 libgdk-3.so.0`gdk_threads_dispatch(data=0x000000080335d580) at gdk.c:777:11
    frame #81: 0x00000008003493a7 libglib-2.0.so.0`g_timeout_dispatch(source=0x00000008024e6f40, callback=(libgdk-3.so.0`gdk_threads_dispatch at gdk.c:770), user_data=0x000000080335d580) at gmain.c:4649:11
    frame #82: 0x000000080034da73 libglib-2.0.so.0`g_main_dispatch(context=0x00000008024e1240) at gmain.c:3176:27
    frame #83: 0x000000080034d8c0 libglib-2.0.so.0`g_main_context_dispatch(context=0x00000008024e1240) at gmain.c:3829:7
    frame #84: 0x000000080034de0a libglib-2.0.so.0`g_main_context_iterate(context=0x00000008024e1240, block=1, dispatch=1, self=0x00000008024c0c60) at gmain.c:3902:5
    frame #85: 0x000000080034de83 libglib-2.0.so.0`g_main_context_iteration(context=0x00000008024e1240, may_block=1) at gmain.c:3963:12
    frame #86: 0x000000080111ae51 libgio-2.0.so.0`g_application_run(application=0x000000080250c0f0, argc=2, argv=0x00007fffffffeb90) at gapplication.c:2470:7
    frame #87: 0x000000000021c3dc wavbreaker`main(argc=2, argv=0x00007fffffffeb90) at wavbreaker.c:3007:14
    frame #88: 0x000000000020c10f wavbreaker`_start(ap=<unavailable>, cleanup=<unavailable>) at crt1.c:76:7
  thread #2, name = 'wavbreaker'
    frame #0: 0x000000080140612a libc.so.7`_poll at _poll.S:3
    frame #1: 0x0000000801853246 libthr.so.3`__thr_poll(fds=<unavailable>, nfds=<unavailable>, timeout=<unavailable>) at thr_syscalls.c:338:8
    frame #2: 0x0000000800363861 libglib-2.0.so.0`g_poll(fds=0x0000000802524000, nfds=1, timeout=-1) at gpoll.c:124:10
    frame #3: 0x000000080034ff5a libglib-2.0.so.0`g_main_context_poll(context=0x00000008024e1300, timeout=-1, priority=2147483647, fds=0x0000000802524000, n_fds=1) at gmain.c:4203:13
    frame #4: 0x000000080034dde1 libglib-2.0.so.0`g_main_context_iterate(context=0x00000008024e1300, block=1, dispatch=1, self=0x0000000802511140) at gmain.c:3897:3
    frame #5: 0x000000080034de83 libglib-2.0.so.0`g_main_context_iteration(context=0x00000008024e1300, may_block=1) at gmain.c:3963:12
    frame #6: 0x000000080034f81d libglib-2.0.so.0`glib_worker_main(data=0x0000000000000000) at gmain.c:5772:7
    frame #7: 0x000000080038658d libglib-2.0.so.0`g_thread_proxy(data=0x0000000802511140) at gthread.c:784:20
    frame #8: 0x0000000801850736 libthr.so.3`thread_start(curthread=0x0000000802498500) at thr_create.c:292:16
  thread #3, name = 'wavbreaker'
    frame #0: 0x000000080140612a libc.so.7`_poll at _poll.S:3
    frame #1: 0x0000000801853246 libthr.so.3`__thr_poll(fds=<unavailable>, nfds=<unavailable>, timeout=<unavailable>) at thr_syscalls.c:338:8
    frame #2: 0x0000000800363861 libglib-2.0.so.0`g_poll(fds=0x0000000802564020, nfds=2, timeout=-1) at gpoll.c:124:10
    frame #3: 0x000000080034ff5a libglib-2.0.so.0`g_main_context_poll(context=0x00000008024e1540, timeout=-1, priority=2147483647, fds=0x0000000802564020, n_fds=2) at gmain.c:4203:13
    frame #4: 0x000000080034dde1 libglib-2.0.so.0`g_main_context_iterate(context=0x00000008024e1540, block=1, dispatch=1, self=0x00000008025111e0) at gmain.c:3897:3
    frame #5: 0x000000080034e2ce libglib-2.0.so.0`g_main_loop_run(loop=0x000000080251a480) at gmain.c:4098:5
    frame #6: 0x00000008011643ae libgio-2.0.so.0`gdbus_shared_thread_func(user_data=0x00000008025286e0) at gdbusprivate.c:275:3
    frame #7: 0x000000080038658d libglib-2.0.so.0`g_thread_proxy(data=0x00000008025111e0) at gthread.c:784:20
    frame #8: 0x0000000801850736 libthr.so.3`thread_start(curthread=0x0000000802498a00) at thr_create.c:292:16
  thread #4, name = 'wavbreaker'
    frame #0: 0x000000080185eedc libthr.so.3`_umtx_op_err at _umtx_op_err.S:37
    frame #1: 0x00000008018526c0 libthr.so.3`_thr_umtx_timedwait_uint(mtx=<unavailable>, id=<unavailable>, clockid=<unavailable>, abstime=<unavailable>, shared=<unavailable>) at thr_umtx.c:236:10
    frame #2: 0x000000080185c534 libthr.so.3`cond_wait_common [inlined] cond_wait_user(cvp=<unavailable>, mp=<unavailable>, abstime=0x00007fffdfbfbeb0, cancel=0) at thr_cond.c:320:11
    frame #3: 0x000000080185c41a libthr.so.3`cond_wait_common(cond=<unavailable>, mutex=<unavailable>, abstime=0x00007fffdfbfbeb0, cancel=0) at thr_cond.c:380
    frame #4: 0x00000008003b47f0 libglib-2.0.so.0`g_cond_wait_until(cond=0x000000080249da08, mutex=0x000000080249da00, end_time=287679430434) at gthread-posix.c:908:19
    frame #5: 0x0000000800309b58 libglib-2.0.so.0`g_async_queue_pop_intern_unlocked(queue=0x000000080249da00, wait=1, end_time=287679430434) at gasyncqueue.c:422:13
    frame #6: 0x0000000800309ddf libglib-2.0.so.0`g_async_queue_timeout_pop_unlocked(queue=0x000000080249da00, timeout=500000) at gasyncqueue.c:570:10
    frame #7: 0x0000000800387c83 libglib-2.0.so.0`g_thread_pool_wait_for_new_task(pool=0x00000008024d2540) at gthreadpool.c:262:18
    frame #8: 0x0000000800387a6a libglib-2.0.so.0`g_thread_pool_thread_proxy(data=0x00000008024d2540) at gthreadpool.c:296:14
    frame #9: 0x000000080038658d libglib-2.0.so.0`g_thread_proxy(data=0x00000008025112d0) at gthread.c:784:20
    frame #10: 0x0000000801850736 libthr.so.3`thread_start(curthread=0x0000000802498f00) at thr_create.c:292:16
@thp
Copy link
Owner

thp commented Nov 20, 2019

Thanks for this detailed bug report!

I wasn't able to reproduce it on my machine (Quartz Backend, macOS), but have a hunch why it happens, and it needs fixing, as the code as it is right now isn't thread-safe.

The open thread does the following (after graphData->numSamples has been set in src/sample.c):

    track_break_clear_list();
    track_break_add_entry();

Now, if the UI thread draws the waveform between those two calls, it will already see numSamples as non-zero, but track_break_list will be NULL, resulting in a null pointer dereference when looking for the current track break. A "quick fix" would be to add null pointer checks to draw.c, but the real fix might be slightly different (maybe only updating numSamples and the track breaks in the UI thread, instead of accessing it unprotected from multiple threads at the same time).

I'll check to see if I can repro it on Linux/X11 or if I can set up a FreeBSD machine, and failing that, I'll propose a PR for you to test on your machine if that's okay :)

@thp
Copy link
Owner

thp commented Nov 20, 2019

Or possibly even simpler, can you try this patch?

diff --git a/src/wavbreaker.c b/src/wavbreaker.c
index 04b2d66..2001cb2 100644
--- a/src/wavbreaker.c
+++ b/src/wavbreaker.c
@@ -1313,10 +1313,6 @@ file_open_progress_idle_func(gpointer data) {
         /* Reset things because we have a new file             */
         /* --------------------------------------------------- */
 
-        cursor_marker = 0;
-        track_break_clear_list();
-        track_break_add_entry();
-
         gtk_adjustment_set_value(GTK_ADJUSTMENT(adj), 0);
         gtk_adjustment_set_value(GTK_ADJUSTMENT(cursor_marker_spinner_adj), 0);
         gtk_adjustment_set_value(GTK_ADJUSTMENT(cursor_marker_min_spinner_adj), 0);
@@ -1399,6 +1395,10 @@ static void open_file() {
 
     menu_stop(NULL, NULL);
 
+    cursor_marker = 0;
+    track_break_clear_list();
+    track_break_add_entry();
+
     if (file_open_progress_source_id) {
         g_source_remove(file_open_progress_source_id);
     }

@jbeich
Copy link
Contributor Author

jbeich commented Nov 20, 2019

The patch does help: I can't reproduce anymore. Tested GDK_BACKEND=x11 and GDK_BACKEND=wayland, on amd64 and i386, with Clang 8/9 and GCC 9.

@thp thp closed this as completed in c5df6de Nov 20, 2019
thp added a commit that referenced this issue Nov 20, 2019
Reset track breaks before loading (Fixes #7)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants