瀏覽代碼

Merge branch 'release/1.10.x'

rdb 5 年之前
父節點
當前提交
3598222977

+ 15 - 11
dtool/src/dtoolutil/executionEnvironment.cxx

@@ -805,21 +805,25 @@ read_args() {
 #elif defined(IS_FREEBSD)
   // In FreeBSD, we can use sysctl to determine the command-line arguments.
 
-  size_t bufsize = 4096;
-  char buffer[4096];
+  size_t bufsize = 0;
   int mib[4] = {CTL_KERN, KERN_PROC, KERN_PROC_ARGS, 0};
   mib[3] = getpid();
-  if (sysctl(mib, 4, (void*) buffer, &bufsize, nullptr, 0) == -1) {
+  if (sysctl(mib, 4, nullptr, &bufsize, nullptr, 0) == -1) {
     perror("sysctl");
   } else {
-    if (_binary_name.empty()) {
-      _binary_name = buffer;
-    }
-    size_t idx = strlen(buffer) + 1;
-    while (idx < bufsize) {
-      _args.push_back((char*)(buffer + idx));
-      size_t newidx = strlen(buffer + idx);
-      idx += newidx + 1;
+    char *buffer = (char *)alloca(bufsize);
+    if (sysctl(mib, 4, buffer, &bufsize, nullptr, 0) == -1) {
+      perror("sysctl");
+    } else {
+      if (_binary_name.empty()) {
+        _binary_name = buffer;
+      }
+      size_t idx = strlen(buffer) + 1;
+      while (idx < bufsize) {
+        _args.push_back((char*)(buffer + idx));
+        size_t newidx = strlen(buffer + idx);
+        idx += newidx + 1;
+      }
     }
   }
 

+ 2 - 2
panda/src/collide/collisionPolygon.cxx

@@ -527,8 +527,8 @@ test_intersection_from_sphere(const CollisionEntry &entry) const {
     max_dist = csqrt(max_dist_2);
   }
 
-  if (dist > max_dist) {
-    // There's no intersection: the sphere is hanging off the edge.
+  if (dist > max_dist || -dist > max_dist) {
+    // There's no intersection: the sphere is hanging above or under the edge.
     return nullptr;
   }
 

+ 1 - 1
panda/src/collide/collisionPolygon.h

@@ -32,12 +32,12 @@ PUBLISHED:
                           const LVecBase3 &c);
   INLINE CollisionPolygon(const LVecBase3 &a, const LVecBase3 &b,
                           const LVecBase3 &c, const LVecBase3 &d);
-  INLINE CollisionPolygon(const LPoint3 *begin, const LPoint3 *end);
 
 private:
   INLINE CollisionPolygon();
 
 public:
+  INLINE CollisionPolygon(const LPoint3 *begin, const LPoint3 *end);
   CollisionPolygon(const CollisionPolygon &copy);
 
   virtual CollisionSolid *make_copy();

+ 6 - 0
panda/src/event/pythonTask.cxx

@@ -798,6 +798,12 @@ void PythonTask::
 upon_death(AsyncTaskManager *manager, bool clean_exit) {
   AsyncTask::upon_death(manager, clean_exit);
 
+  // If we were polling something when we were removed, get rid of it.
+  if (_future_done != nullptr) {
+    Py_DECREF(_future_done);
+    _future_done = nullptr;
+  }
+
   if (_upon_death != Py_None) {
 #if defined(HAVE_THREADS) && !defined(SIMPLE_THREADS)
     // Use PyGILState to protect this asynchronous call.