all repos — mgba @ b3c7bd8227dcb77222bd596c0cff474919bd5b99

mGBA Game Boy Advance Emulator

Qt: Fix lifetime issues with filename loading
Jeffrey Pfau jeffrey@endrift.com
Sat, 03 Sep 2016 19:08:09 -0700
commit

b3c7bd8227dcb77222bd596c0cff474919bd5b99

parent

f17e3276265594b09218aaec4f8044a026ecb194

1 files changed, 5 insertions(+), 5 deletions(-)

jump to
M src/platform/qt/GameController.cppsrc/platform/qt/GameController.cpp

@@ -368,20 +368,20 @@ m_threadContext.core->desiredVideoDimensions(m_threadContext.core, &width, &height);

m_drawContext = new uint32_t[width * height]; m_frontBuffer = new uint32_t[width * height]; - const char* base; + QByteArray bytes; if (!biosOnly) { - base = m_fname.toUtf8().constData(); + bytes = m_fname.toUtf8(); if (m_vf) { m_threadContext.core->loadROM(m_threadContext.core, m_vf); } else { - mCoreLoadFile(m_threadContext.core, base); + mCoreLoadFile(m_threadContext.core, bytes.constData()); mDirectorySetDetachBase(&m_threadContext.core->dirs); } } else { - base = m_bios.toUtf8().constData(); + bytes = m_bios.toUtf8(); } char dirname[PATH_MAX]; - separatePath(base, dirname, m_threadContext.core->dirs.baseName, 0); + separatePath(bytes.constData(), dirname, m_threadContext.core->dirs.baseName, 0); mDirectorySetAttachBase(&m_threadContext.core->dirs, VDirOpen(dirname)); m_threadContext.core->setVideoBuffer(m_threadContext.core, m_drawContext, width);