From af8244e3e02690e251d24f38abbb1e7742250758 Mon Sep 17 00:00:00 2001 From: Michele Calgaro Date: Sat, 16 Jun 2018 21:45:03 +0900 Subject: Fixed problem with dlsym lookup. This resolve bug 2477. Partially inspired by posts at https://stackoverflow.com/questions/15599026/how-can-i-intercept-dlsym-calls-using-ld-preload Signed-off-by: Michele Calgaro --- tqt/kqt3.cpp | 32 +++++++++++++++++++------------- 1 file changed, 19 insertions(+), 13 deletions(-) (limited to 'tqt/kqt3.cpp') diff --git a/tqt/kqt3.cpp b/tqt/kqt3.cpp index 8ceb265..97b3584 100644 --- a/tqt/kqt3.cpp +++ b/tqt/kqt3.cpp @@ -120,19 +120,25 @@ static const char * getAppName(bool useTQt=true) int TQApplication::exec() { - static bool init=false; - - if(!init) - { - connectToKDialogD(getAppName(false)); - init=true; - } - - static int (*realFunction)(void *); - - if(!realFunction) - realFunction = (int (*)(void *)) dlsym(RTLD_NEXT, KQT_QAPPLICATION_EXEC); - return (int)realFunction(this); + static bool init=false; + + if(!init) + { + connectToKDialogD(getAppName(false)); + init=true; + } + + static int (*realFunction)(void *); + + if(!realFunction) + realFunction = (int (*)(void *)) dlsym(RTLD_NEXT, KQT_QAPPLICATION_EXEC); + if (realFunction) + return (int)realFunction(this); + else + { + tqWarning("kgtk-qt3 tqt TQApplication::exec() realFunction not found!!"); + return 255; + } }; static TQString qt2KdeFilter(const TQString &f) -- cgit v1.2.3