From 849f66a663423011dc3fcc1aa77fc9c85cf0962c Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Mon, 29 Apr 2013 20:47:44 +0200 Subject: Correct stale pointer dereference --- facetracknoir/facetracknoir.cpp | 9 ++++++--- facetracknoir/global-settings.cpp | 3 ++- 2 files changed, 8 insertions(+), 4 deletions(-) (limited to 'facetracknoir') diff --git a/facetracknoir/facetracknoir.cpp b/facetracknoir/facetracknoir.cpp index 2338303e..10a188cc 100644 --- a/facetracknoir/facetracknoir.cpp +++ b/facetracknoir/facetracknoir.cpp @@ -1038,7 +1038,8 @@ void FaceTrackNoIR::createIconGroupBox() QIcon icon; QString longName; QString str = protocols.at(i); - DynamicLibrary* lib = new DynamicLibrary(str.toLatin1().constData()); + QByteArray latin1 = str.toLatin1(); + DynamicLibrary* lib = new DynamicLibrary(latin1.constData()); qDebug() << "Loading" << str; std::cout.flush(); Metadata* meta; @@ -1062,7 +1063,8 @@ void FaceTrackNoIR::createIconGroupBox() QIcon icon; QString longName; QString str = trackers.at(i); - DynamicLibrary* lib = new DynamicLibrary(str.toLatin1().constData()); + QByteArray latin1 = str.toLatin1(); + DynamicLibrary* lib = new DynamicLibrary(latin1.constData()); qDebug() << "Loading" << str; std::cout.flush(); Metadata* meta; @@ -1088,7 +1090,8 @@ void FaceTrackNoIR::createIconGroupBox() QIcon icon; QString fullName; QString str = filters.at(i); - DynamicLibrary* lib = new DynamicLibrary(str.toLatin1().constData()); + QByteArray latin1 = str.toLatin1(); + DynamicLibrary* lib = new DynamicLibrary(latin1.constData()); qDebug() << "Loading" << str; std::cout.flush(); Metadata* meta; diff --git a/facetracknoir/global-settings.cpp b/facetracknoir/global-settings.cpp index f0f0413e..be7fd7a7 100644 --- a/facetracknoir/global-settings.cpp +++ b/facetracknoir/global-settings.cpp @@ -104,7 +104,8 @@ DynamicLibrary::DynamicLibrary(const char* filename) Constructor = (NULLARY_DYNAMIC_FUNCTION) handle->resolve(MAYBE_STDCALL_UNDERSCORE "GetConstructor" CALLING_CONVENTION_SUFFIX_VOID_FUNCTION); Metadata = (METADATA_FUNCTION) handle->resolve(MAYBE_STDCALL_UNDERSCORE "GetMetadata" CALLING_CONVENTION_SUFFIX_VOID_FUNCTION); #else - handle = dlopen(fullPath.toLatin1().constData(), RTLD_NOW | + QByteArray latin1 = fullPath.toLatin1(); + handle = dlopen(latin1.constData(), RTLD_NOW | # ifdef __linux RTLD_DEEPBIND # else -- cgit v1.2.3