<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Lifetime of QByteArray references when constructing QRawFont using loadFromData()]]></title><description><![CDATA[<p dir="auto">Does Qt make any guarantees about the use and copying of QByteArray objects passed to QRawFont::loadFromData(), and how does this apply to a QByteArray that doesn't own the memory it points to (constructed via QByteArray::fromRawData)?</p>
<p dir="auto">I am working on an application that loads the font bytes in another language and gives a pointer to it to Qt across the FFI boundary to avoid making full copy of the font data. I need to know if Qt will attempt to access that memory even after the QRawFont object has been freed, and I couldn't find anything in the documentation about it.</p>
<p dir="auto">Will destroying the QRawFont object be enough to ensure that the underlying memory is safe to be freed?</p>
]]></description><link>https://forum.qt.io/topic/165228/lifetime-of-qbytearray-references-when-constructing-qrawfont-using-loadfromdata</link><generator>RSS for Node</generator><lastBuildDate>Thu, 05 Nov 2026 16:25:48 GMT</lastBuildDate><atom:link href="https://forum.qt.io/topic/165228.rss" rel="self" type="application/rss+xml"/><pubDate>Sat, 31 Oct 2026 00:02:31 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Lifetime of QByteArray references when constructing QRawFont using loadFromData() on Sat, 31 Oct 2026 21:22:41 GMT]]></title><description><![CDATA[<p dir="auto">If the font engine is destroyed when the QRawFont is, and the font engine isn't shared between different fonts, then it should be fine.<br />
And unfortunately for me, I don't know what fonts or how many fonts might be loaded, so I want to prevent two copies of the font data existing at once.</p>
<p dir="auto">Thanks for the help though!</p>
]]></description><link>https://forum.qt.io/post/840717</link><guid isPermaLink="true">https://forum.qt.io/post/840717</guid><dc:creator><![CDATA[PolarFox]]></dc:creator><pubDate>Sat, 31 Oct 2026 21:22:41 GMT</pubDate></item><item><title><![CDATA[Reply to Lifetime of QByteArray references when constructing QRawFont using loadFromData() on Sat, 31 Oct 2026 11:47:09 GMT]]></title><description><![CDATA[<p dir="auto">If you delete the font the underlying engine is also deleted. But why bother with these few bytes you might save when using fromRawData. It's not worth the trouble.</p>
]]></description><link>https://forum.qt.io/post/840710</link><guid isPermaLink="true">https://forum.qt.io/post/840710</guid><dc:creator><![CDATA[Christian Ehrlicher]]></dc:creator><pubDate>Sat, 31 Oct 2026 11:47:09 GMT</pubDate></item><item><title><![CDATA[Reply to Lifetime of QByteArray references when constructing QRawFont using loadFromData() on Sat, 31 Oct 2026 08:27:43 GMT]]></title><description><![CDATA[<p dir="auto">How long does a QFontEngine live for, and if it lives longer than the QRawFont, can I remove fonts from it? I want to make sure that when a font is no longer needed, I can safely free the data that the QByteArray references, so that I don't keep an unused font in memory.</p>
]]></description><link>https://forum.qt.io/post/840705</link><guid isPermaLink="true">https://forum.qt.io/post/840705</guid><dc:creator><![CDATA[PolarFox]]></dc:creator><pubDate>Sat, 31 Oct 2026 08:27:43 GMT</pubDate></item><item><title><![CDATA[Reply to Lifetime of QByteArray references when constructing QRawFont using loadFromData() on Sat, 31 Oct 2026 06:36:38 GMT]]></title><description><![CDATA[<p dir="auto">You should not pass any object anywhere with a shorter lifetime than where you pass the object too except it is stated otherwise. Therefore make sure the data referenced by QByteArray::fromRawDate() outlifes the QFontEngine or don't use fromRawDate() here.</p>
]]></description><link>https://forum.qt.io/post/840704</link><guid isPermaLink="true">https://forum.qt.io/post/840704</guid><dc:creator><![CDATA[Christian Ehrlicher]]></dc:creator><pubDate>Sat, 31 Oct 2026 06:36:38 GMT</pubDate></item></channel></rss>