patch-gui-wx_wxpython_cpp 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. $OpenBSD: patch-gui-wx_wxpython_cpp,v 1.1 2013/09/09 15:43:25 landry Exp $
  2. --- gui-wx/wxpython.cpp.orig Wed Jun 12 21:23:56 2013
  3. +++ gui-wx/wxpython.cpp Sun Aug 25 11:15:51 2013
  4. @@ -258,6 +258,8 @@ static void GetPythonExceptions()
  5. Py_XDECREF(exmod);
  6. }
  7. +// handle for libutil
  8. +static wxDllType libutildll = NULL;
  9. // handle for Python lib
  10. static wxDllType pythondll = NULL;
  11. @@ -267,15 +269,37 @@ static void FreePythonLib()
  12. wxDynamicLibrary::Unload(pythondll);
  13. pythondll = NULL;
  14. }
  15. +
  16. + if ( libutildll ) {
  17. + wxDynamicLibrary::Unload(libutildll);
  18. + libutildll = NULL;
  19. + }
  20. }
  21. static bool LoadPythonLib()
  22. {
  23. + // load libutil
  24. + wxDynamicLibrary dynlibUtil;
  25. // load the Python library
  26. wxDynamicLibrary dynlib;
  27. // don't log errors in here
  28. wxLogNull noLog;
  29. +
  30. + // Load libutil first, needed for openpty() and forkpty() symbols
  31. + if ( !dynlibUtil.Load(wxT("libutil.so"), wxDL_NOW | wxDL_VERBATIM | wxDL_GLOBAL) ) {
  32. + return false;
  33. + }
  34. +
  35. + if ( dynlibUtil.IsLoaded() ) {
  36. + libutildll = dynlibUtil.Detach();
  37. + }
  38. +
  39. + if ( libutildll == NULL ) {
  40. + // should never happen
  41. + Warning(_("Oh dear, libutil is not loaded!"));
  42. + return false;
  43. + }
  44. // wxDL_GLOBAL corresponds to RTLD_GLOBAL on Linux (ignored on Windows) and
  45. // is needed to avoid an ImportError when importing some modules (eg. time)