Ultralight
Ultralight copied to clipboard
ulDestroyRenderer/ulCreateRenderer crashes
Attempting to call ulDestroyRenderer followed by ulCreateRenderer will crash the application somewhere in ulUpdate when trying to use the newer Renderer instance.
I see in the documentation that ulCreateRenderer should only be called once per process, which I hoped meant "only one should exist at a time" (which would be fine) and not "you can never destroy and re-create it once created".
Our application uses hot-reloading, where all libraries need to be able to be destroyed and recreated when we swap code, so this breaks us badly - is it feasible to make Ultralight able to tear down cleanly?
frame #1: 0x00007f2e21e68457 libUltralightCore.so`ultralight::ImageImpl::~ImageImpl() + 39
frame #2: 0x00007f2e1e6cc813 libWebCore.so`WebCore::ScalableImageDecoderFrame::~ScalableImageDecoderFrame() + 83
frame #3: 0x00007f2e1e6cc368 libWebCore.so`WebCore::ScalableImageDecoder::~ScalableImageDecoder() + 120
frame #4: 0x00007f2e1e6cf630 libWebCore.so`WebCore::GIFImageDecoder::~GIFImageDecoder() + 64
frame #5: 0x00007f2e1f4e110b libWebCore.so`WebCore::ImageSource::~ImageSource() + 571
frame #6: 0x00007f2e1f4a2ab4 libWebCore.so`WebCore::BitmapImage::~BitmapImage() + 164
frame #7: 0x00007f2e1f4a2b99 libWebCore.so`WebCore::BitmapImage::~BitmapImage() + 9
frame #8: 0x00007f2e1f36ad1a libWebCore.so`WebCore::CachedImage::destroyDecodedData() + 154
frame #9: 0x00007f2e1f37ffd9 libWebCore.so`WebCore::MemoryCache::pruneDeadResourcesToSize(unsigned int) + 473
frame #10: 0x00007f2e1f3e17be libWebCore.so`WebCore::releaseMemory(WTF::Critical, WTF::Synchronous, WebCore::MaintainPageCache, WebCore::MaintainMemoryCache) + 862
frame #11: 0x00007f2e228cbd65 libUltralight.so`ultralight::RendererImpl::Update() + 325
frame #12: 0x00007f2e228b51ff libUltralight.so`ulUpdate + 687
In case it's at all useful, I am able to hot-reload the renderer so long as my view only loads minimal HTML (e.g. <h1>Hello World</h1>).
I implemented my own filesystem/fontloader/logger to work around a different issue and the ulDestroyRenderer/ulCreateRenderer crash occurs on ulCreateView now.
(lldb) bt
* thread #1, name = 'lua', stop reason = signal SIGSEGV: invalid address (fault address: 0x4)
* frame #0: 0x00007fe478453d60 libWebCore.so`JSC::JSLock::lock(long) + 32
frame #1: 0x00007fe476c0b1eb libWebCore.so`WebCore::MicrotaskQueue::performMicrotaskCheckpoint() + 43
frame #2: 0x00007fe476bc6478 libWebCore.so`WebCore::Document::finishedParsing() + 184
frame #3: 0x00007fe476e1922a libWebCore.so`WebCore::HTMLDocumentParser::prepareToStopParsing() + 186
frame #4: 0x00007fe476e1aaca libWebCore.so`WebCore::HTMLDocumentParser::finish() + 266
frame #5: 0x00007fe476efcf27 libWebCore.so`WebCore::DocumentWriter::end() + 55
frame #6: 0x00007fe476eef153 libWebCore.so`WebCore::DocumentLoader::finishedLoading() + 467
frame #7: 0x00007fe476ef398d libWebCore.so`WebCore::DocumentLoader::maybeLoadEmpty() + 717
frame #8: 0x00007fe476ef3bb1 libWebCore.so`WebCore::DocumentLoader::startLoadingMainResource() + 481
frame #9: 0x00007fe476f0723b libWebCore.so`WebCore::FrameLoader::init() + 507
frame #10: 0x00007fe47a086eb5 libUltralight.so`WebCore::WebPage::WebPage(ultralight::ViewImpl*, ultralight::ViewConfig const&, ultralight::SessionImpl*) + 3637
frame #11: 0x00007fe47a0618aa libUltralight.so`ultralight::ViewImpl::InitWithFrame(unsigned int, unsigned int) + 1194
frame #12: 0x00007fe47a059c07 libUltralight.so`ultralight::RendererImpl::CreateView(unsigned int, unsigned int, ultralight::ViewConfig const&, ultralight::RefPtr<ultralight::Session>) + 183
frame #13: 0x00007fe47a04837f libUltralight.so`ulCreateView + 1103
frame #14: 0x00007fe470f19d37 ab742829b618eb82.so`rt_f11(L=0x0000563cecd962b0) at rt-GtUftx.c:91:27
frame #15: 0x0000563ceb589328 lua`luaD_call(L=0x0000563cecd962b0, func=0x0000563cf3373210, nresults=0) at ldo.c:482:11