瀏覽代碼

fix crash

David Rose 16 年之前
父節點
當前提交
a663c348d3
共有 1 個文件被更改,包括 3 次插入2 次删除
  1. 3 2
      direct/src/plugin/p3dSession.cxx

+ 3 - 2
direct/src/plugin/p3dSession.cxx

@@ -426,8 +426,9 @@ p3dobj_to_xml(const P3D_object *obj) {
       // Otherwise, it must a host-provided object, which means we
       // Otherwise, it must a host-provided object, which means we
       // should pass a reference down to this particular object, so
       // should pass a reference down to this particular object, so
       // the Python process knows to call back up to here to query it.
       // the Python process knows to call back up to here to query it.
-      // TODO: pass pointers better.
-      int object_id = (int)obj;
+      // TODO: pass pointers better.  Fix this hideous leak.
+      P3D_object *dup = P3D_OBJECT_COPY(obj);
+      int object_id = (int)dup;
       xvalue->SetAttribute("type", "browser");
       xvalue->SetAttribute("type", "browser");
       xvalue->SetAttribute("object_id", object_id);
       xvalue->SetAttribute("object_id", object_id);