From 012f0a33296c79f1717c09c4d2e9cbc9957a85dc Mon Sep 17 00:00:00 2001 From: Vicki Pfau Date: Sat, 11 Feb 2017 15:45:08 -0800 Subject: [PATCH] Qt: Handle invalid libraries --- src/platform/qt/LibraryModel.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/platform/qt/LibraryModel.cpp b/src/platform/qt/LibraryModel.cpp index 0dc96fe2a..52173c622 100644 --- a/src/platform/qt/LibraryModel.cpp +++ b/src/platform/qt/LibraryModel.cpp @@ -89,7 +89,12 @@ LibraryModel::LibraryModel(const QString& path, QObject* parent) 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(mLibrary* lib, const QString& p) LibraryModel::LibraryHandle::~LibraryHandle() { m_loaderThread.quit(); m_loaderThread.wait(); - mLibraryDestroy(library); + if (library) { + mLibraryDestroy(library); + } } void LibraryModel::LibraryHandle::ref() {