Qt: Handle invalid libraries
Vicki Pfau vi@endrift.com
Sat, 11 Feb 2017 15:45:08 -0800
1 files changed,
9 insertions(+),
2 deletions(-)
jump to
M
src/platform/qt/LibraryModel.cpp
→
src/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() {