Paul-Dempsey / pachde1

VCV Rack modules
Other
6 stars 0 forks source link

Seg fault on exit [Rack v2.3.0 (debug build), Windows 10] #6

Closed SteveRussell33 closed 1 year ago

SteveRussell33 commented 1 year ago

Added Imagine module to empty rack. Immediatly close app.

Thread 1 received signal SIGSEGV, Segmentation fault.
nvgDeleteImage (ctx=0x0, image=5) at dep/nanovg/src/nanovg.c:890
890             ctx->params.renderDeleteTexture(ctx->params.userPtr, image);
(gdb) bt
#0  nvgDeleteImage (ctx=0x0, image=5) at dep/nanovg/src/nanovg.c:890
#1  0x00007fffc5783b51 in pachde::cachePic::clearImageCache (vg=<optimized out>, this=0x78dc608) at src/Imagine/../pic.hpp:143
#2  pachde::cachePic::onContextDestroy (e=..., this=0x78dc608) at src/Imagine/../pic.hpp:120
#3  pachde::PicWidget::onContextDestroy (this=0x78dc5b0, e=...) at src/Imagine/pic_widget.hpp:43
#4  0x00007fffc577e691 in rack::widget::Widget::recurseEvent<void (rack::widget::Widget::*)(rack::widget::Widget::ContextDestroyEvent const&), rack::widget::Widget::Co
ntextDestroyEvent> (e=..., f=&virtual table offset 328, this=0x78dc0d0) at ../../include/widget/Widget.hpp:187
#5  rack::widget::Widget::onContextDestroy (this=0x78dc0d0, e=...) at ../../include/widget/Widget.hpp:515
#6  0x00007fffda604e31 in rack::widget::Widget::recurseEvent<void (rack::widget::Widget::*)(rack::widget::Widget::ContextDestroyEvent const&), rack::widget::Widget::Co
ntextDestroyEvent> (e=..., f=&virtual table offset 328, this=0x980900) at include/widget/Widget.hpp:187
#7  rack::widget::Widget::onContextDestroy (this=0x980900, e=...) at include/widget/Widget.hpp:515
#8  0x00007fffda604e31 in rack::widget::Widget::recurseEvent<void (rack::widget::Widget::*)(rack::widget::Widget::ContextDestroyEvent const&), rack::widget::Widget::Co
ntextDestroyEvent> (e=..., f=&virtual table offset 328, this=0x74aa270) at include/widget/Widget.hpp:187
#9  rack::widget::Widget::onContextDestroy (this=0x74aa270, e=...) at include/widget/Widget.hpp:515
#10 0x00007fffda604e31 in rack::widget::Widget::recurseEvent<void (rack::widget::Widget::*)(rack::widget::Widget::ContextDestroyEvent const&), rack::widget::Widget::Co
ntextDestroyEvent> (e=..., f=&virtual table offset 328, this=0x74aa1f0) at include/widget/Widget.hpp:187
#11 rack::widget::Widget::onContextDestroy (this=0x74aa1f0, e=...) at include/widget/Widget.hpp:515
#12 0x00007fffda604e31 in rack::widget::Widget::recurseEvent<void (rack::widget::Widget::*)(rack::widget::Widget::ContextDestroyEvent const&), rack::widget::Widget::Co
ntextDestroyEvent> (e=..., f=&virtual table offset 328, this=0x74aa050) at include/widget/Widget.hpp:187
#13 rack::widget::Widget::onContextDestroy (this=0x74aa050, e=...) at include/widget/Widget.hpp:515
#14 0x00007fffda604e31 in rack::widget::Widget::recurseEvent<void (rack::widget::Widget::*)(rack::widget::Widget::ContextDestroyEvent const&), rack::widget::Widget::Co
ntextDestroyEvent> (e=..., f=&virtual table offset 328, this=0x74a9f80) at include/widget/Widget.hpp:187
#15 rack::widget::Widget::onContextDestroy (this=0x74a9f80, e=...) at include/widget/Widget.hpp:515
#16 0x00007fffda1bb0db in rack::widget::Widget::recurseEvent<void (rack::widget::Widget::*)(rack::widget::Widget::ContextDestroyEvent const&), rack::widget::Widget::Co
ntextDestroyEvent> (e=..., f=&virtual table offset 328, this=0x74a9ed0) at include/widget/Widget.hpp:187
#17 rack::widget::Widget::onContextDestroy (e=..., this=0x74a9ed0) at include/widget/Widget.hpp:515
#18 rack::window::Window::~Window (this=this@entry=0x6f6a7d0, __in_chrg=<optimized out>) at src/window/Window.cpp:369
#19 0x00007fffda136780 in rack::Context::~Context (this=0x7363ba0, __in_chrg=<optimized out>) at src/context.cpp:19
#20 0x00007ff74e20112e in main (argc=<optimized out>, argv=<optimized out>) at adapters/standalone.cpp:279
SteveRussell33 commented 1 year ago

Looks like https://github.com/Paul-Dempsey/pachde1/commit/4a6d7f483332c2610d85462ecf30edf553fdc5e2 fixed this.

Paul-Dempsey commented 1 year ago

Just saw this issue.

Rack 2.3 and earlier have a bug where the graphics context in the onContextCreate and onContextDestroy events is uninitialized. I reported it, and Andrew says it'll be fixed in the next release.

This crashed for you because for a time, the checked in code depended on that fix that only the next release of Rack will have. As part of getting my plugin ready for release, I switched back to the workaround for managing the nvg image handle.

SteveRussell33 commented 1 year ago

Thanks Paul for the explanation, I didn't know about the Rack bug so this has been a small lesson in nvg for me.

Cheers!