]> git.mxchange.org Git - flightgear.git/commitdiff
We can't remove ssg branches in the threaded tile page because if we happen
authorcurt <curt>
Sun, 20 May 2001 06:49:06 +0000 (06:49 +0000)
committercurt <curt>
Sun, 20 May 2001 06:49:06 +0000 (06:49 +0000)
to have attached an ssg loaded object to this branch, then plib will remove
it and all it's states (and textures) which will call opengl api commands
which will crash the program if run from a separate thread from the main render
thread.

src/Scenery/FGTileLoader.cxx
src/Scenery/FGTileLoader.hxx
src/Scenery/newcache.cxx
src/Scenery/tileentry.cxx
src/Scenery/tileentry.hxx
src/Scenery/tilemgr.hxx

index 8f04c78c8a7fb106011a0637d87ee78025d79fc1..661833e2824e7ee17477908d57a56a68801113a0 100644 (file)
@@ -89,6 +89,7 @@ FGTileLoader::add( FGTileEntry* tile )
     tile_load_queue.push( tile );
 }
 
+#ifdef WISH_PLIB_WAS_THREADED // but it isn't
 /**
  * 
  */
@@ -97,6 +98,7 @@ FGTileLoader::remove( FGTileEntry* tile )
 {
     tile_free_queue.push( tile );
 }
+#endif
 
 /**
  * 
@@ -156,6 +158,7 @@ FGTileLoader::LoaderThread::run()
 
        FGTileMgr::ready_to_attach( tile );
 
+#ifdef WISH_PLIB_WAS_THREADED // but it isn't
        // Handle and pending removals
        while ( !loader->tile_free_queue.empty() ) {
            cout << "freeing next tile ..." << endl;
@@ -164,6 +167,8 @@ FGTileLoader::LoaderThread::run()
            tile->free_tile();
            delete tile;
        }
+#endif
+
     }
     pthread_cleanup_pop(1);
 }
index 258232a52bc516dfcd71dbd4e81c20090c7bcd6c..f8d1ba03ba420eae160a98dd9545d66eecd23a98 100644 (file)
@@ -60,11 +60,13 @@ public:
      */
     void add( FGTileEntry* tile );
 
+#ifdef WISH_PLIB_WAS_THREADED // but it isn't
     /**
      * Remove a tile from memory.
      * @param tile The tile to be removed from memory.
      */
     void remove( FGTileEntry* tile );
+#endif
 
     /**
      * The tile loader thread will only load one tile per call to the
@@ -89,10 +91,10 @@ private:
      * FIFO queue of tiles to load from data files.
      */
     SGBlockingQueue< FGTileEntry * > tile_load_queue;
-    SGBlockingQueue< FGTileEntry * > tile_free_queue;
+    // SGBlockingQueue< FGTileEntry * > tile_free_queue;
 #else
     queue< FGTileEntry * > tile_load_queue;
-    queue< FGTileEntry * > tile_free_queue;
+    // queue< FGTileEntry * > tile_free_queue;
 #endif
 
     /**
index c7e59195e54a1dc79c50b538b3a21da1da89f816..841fb4bac071b0cefe90a30ab4e972f7996b3da3 100644 (file)
@@ -64,9 +64,10 @@ void FGNewCache::entry_free( long cache_index ) {
     SG_LOG( SG_TERRAIN, SG_DEBUG, "FREEING CACHE ENTRY = " << cache_index );
     FGTileEntry *tile = tile_cache[cache_index];
     tile->disconnect_ssg_nodes();
-    tile->sched_removal();
 
-#if 0
+#ifdef WISH_PLIB_WAS_THREADED
+    tile->sched_removal();
+#else // plib isn't threaded so we always go here
     tile->free_tile();
     delete tile;
 #endif
index 4bc931ae1f9740a1658d7f592b86a587fcef2fe0..5ba0900d892383b1cc03fabe8b68434b6b0992e0 100644 (file)
@@ -105,11 +105,15 @@ static void my_remove_branch( ssgBranch * branch ) {
 }
 
 
+#ifdef WISH_PLIB_WAS_THREADED // but it isn't
+
 // Schedule tile to be freed/removed
 void FGTileEntry::sched_removal() {
     global_tile_mgr.ready_to_delete( this );
 }
 
+#endif
+
 
 // Clean up the memory used by this tile and delete the arrays used by
 // ssg as well as the whole ssg branch
index 5199f8f924847c837ba685e9569bb7104a42d02d..d1fdb93e26c0709c79620856f01da52c18c1f69b 100644 (file)
@@ -177,8 +177,10 @@ public:
     // Destructor
     ~FGTileEntry();
 
+#ifdef WISH_PLIB_WAS_THREADED // but it isn't
     // Schedule tile to be freed/removed
     void sched_removal();
+#endif
 
     // Clean up the memory used by this tile and delete the arrays
     // used by ssg as well as the whole ssg branch
index 0dfc968ed29eddc83ec3c79f687707917cc4c449..b4ae8ac1d4d3e9be11e41415c53b066c4477b924 100644 (file)
@@ -143,10 +143,12 @@ public:
      */
     static void ready_to_attach( FGTileEntry *t ) { attach_queue.push( t ); }
 
+#ifdef WISH_PLIB_WAS_THREADED // but it isn't
     /**
      * Tile is detatched from scene graph and is ready to delete
      */
     inline void ready_to_delete( FGTileEntry *t ) { loader.remove( t ); }
+#endif
 
     /**
      * Add a pending model to the 'deferred model load' queue