all repos — mgba @ 012f0a33296c79f1717c09c4d2e9cbc9957a85dc

mGBA Game Boy Advance Emulator

Qt: Handle invalid libraries
Vicki Pfau vi@endrift.com
Sat, 11 Feb 2017 15:45:08 -0800
commit

012f0a33296c79f1717c09c4d2e9cbc9957a85dc

parent

50defa2ecd931322b9c49ea9923323b39813ccf6

1 files changed, 9 insertions(+), 2 deletions(-)

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

@@ -89,7 +89,12 @@ m_library = s_handles[path];

m_library->ref(); } else { m_library = new LibraryHandle(mLibraryLoad(path.toUtf8().constData()), path); - s_handles[path] = m_library; + if (m_library->library) { + s_handles[path] = m_library; + } else { + delete m_library; + m_library = new LibraryHandle(mLibraryCreateEmpty()); + } } } else { m_library = new LibraryHandle(mLibraryCreateEmpty());

@@ -280,7 +285,9 @@

LibraryModel::LibraryHandle::~LibraryHandle() { m_loaderThread.quit(); m_loaderThread.wait(); - mLibraryDestroy(library); + if (library) { + mLibraryDestroy(library); + } } void LibraryModel::LibraryHandle::ref() {