fix-segfault.diff 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. Index: libX11-1.4.99.1/src/Xrm.c
  2. ===================================================================
  3. --- libX11-1.4.99.1.orig/src/Xrm.c
  4. +++ libX11-1.4.99.1/src/Xrm.c
  5. @@ -2540,30 +2540,40 @@ Bool XrmQGetResource(
  6. VClosureRec closure;
  7. if (db && *names) {
  8. - _XLockMutex(&db->linfo);
  9. + if ((_XLockMutex_fn) && db->linfo.lock ) {
  10. + _XLockMutex(&db->linfo);
  11. + }
  12. closure.type = pType;
  13. closure.value = pValue;
  14. table = db->table;
  15. if (names[1]) {
  16. if (table && !table->leaf) {
  17. if (GetNEntry(table, names, classes, &closure)) {
  18. - _XUnlockMutex(&db->linfo);
  19. + if ((_XUnlockMutex_fn) && db->linfo.lock ) {
  20. + _XUnlockMutex(&db->linfo);
  21. + }
  22. return True;
  23. }
  24. } else if (table && table->hasloose &&
  25. GetLooseVEntry((LTable)table, names, classes, &closure)) {
  26. - _XUnlockMutex (&db->linfo);
  27. + if ((_XUnlockMutex_fn) && db->linfo.lock ) {
  28. + _XUnlockMutex (&db->linfo);
  29. + }
  30. return True;
  31. }
  32. } else {
  33. if (table && !table->leaf)
  34. table = table->next;
  35. if (table && GetVEntry((LTable)table, names, classes, &closure)) {
  36. - _XUnlockMutex(&db->linfo);
  37. + if ((_XUnlockMutex_fn) && db->linfo.lock ) {
  38. + _XUnlockMutex(&db->linfo);
  39. + }
  40. return True;
  41. }
  42. }
  43. - _XUnlockMutex(&db->linfo);
  44. + if ((_XUnlockMutex_fn) && db->linfo.lock ) {
  45. + _XUnlockMutex(&db->linfo);
  46. + }
  47. }
  48. *pType = NULLQUARK;
  49. pValue->addr = (XPointer)NULL;