Browse Source

pgraph: Fix ModelPool return value reference count

rdb 1 year ago
parent
commit
899af61e2a
3 changed files with 10 additions and 10 deletions
  1. 2 2
      panda/src/pgraph/modelPool.I
  2. 2 2
      panda/src/pgraph/modelPool.cxx
  3. 6 6
      panda/src/pgraph/modelPool.h

+ 2 - 2
panda/src/pgraph/modelPool.I

@@ -42,7 +42,7 @@ verify_model(const Filename &filename) {
  * date (and hasn't been modified in the meantime), and if not, will still
  * return NULL.
  */
-INLINE ModelRoot *ModelPool::
+INLINE PT(ModelRoot) ModelPool::
 get_model(const Filename &filename, bool verify) {
   return get_ptr()->ns_get_model(filename, verify);
 }
@@ -54,7 +54,7 @@ get_model(const Filename &filename, bool verify) {
  * is true and the file has recently changed).  If the model file cannot be
  * found, or cannot be loaded for some reason, returns NULL.
  */
-INLINE ModelRoot *ModelPool::
+INLINE PT(ModelRoot) ModelPool::
 load_model(const Filename &filename, const LoaderOptions &options) {
   return get_ptr()->ns_load_model(filename, options);
 }

+ 2 - 2
panda/src/pgraph/modelPool.cxx

@@ -48,7 +48,7 @@ ns_has_model(const Filename &filename) {
 /**
  * The nonstatic implementation of get_model().
  */
-ModelRoot *ModelPool::
+PT(ModelRoot) ModelPool::
 ns_get_model(const Filename &filename, bool verify) {
 
   PT(ModelRoot) cached_model;
@@ -116,7 +116,7 @@ ns_get_model(const Filename &filename, bool verify) {
 /**
  * The nonstatic implementation of load_model().
  */
-ModelRoot *ModelPool::
+PT(ModelRoot) ModelPool::
 ns_load_model(const Filename &filename, const LoaderOptions &options) {
   // First check if it's been cached under the given filename (for backward
   // compatibility reasons)

+ 6 - 6
panda/src/pgraph/modelPool.h

@@ -43,9 +43,9 @@ class EXPCL_PANDA_PGRAPH ModelPool {
 PUBLISHED:
   INLINE static bool has_model(const Filename &filename);
   INLINE static bool verify_model(const Filename &filename);
-  INLINE static ModelRoot *get_model(const Filename &filename, bool verify);
-  BLOCKING INLINE static ModelRoot *load_model(const Filename &filename,
-                                               const LoaderOptions &options = LoaderOptions());
+  INLINE static PT(ModelRoot) get_model(const Filename &filename, bool verify);
+  BLOCKING INLINE static PT(ModelRoot) load_model(const Filename &filename,
+                                                  const LoaderOptions &options = LoaderOptions());
 
   INLINE static void add_model(const Filename &filename, ModelRoot *model);
   INLINE static void release_model(const Filename &filename);
@@ -65,9 +65,9 @@ private:
   INLINE ModelPool();
 
   bool ns_has_model(const Filename &filename);
-  ModelRoot *ns_get_model(const Filename &filename, bool verify);
-  ModelRoot *ns_load_model(const Filename &filename,
-                           const LoaderOptions &options);
+  PT(ModelRoot) ns_get_model(const Filename &filename, bool verify);
+  PT(ModelRoot) ns_load_model(const Filename &filename,
+                              const LoaderOptions &options);
   void ns_add_model(const Filename &filename, ModelRoot *model);
   void ns_release_model(const Filename &filename);