Ticket #1355: free-cursors.patch
File free-cursors.patch, 2.6 KB (added by , 12 years ago) |
---|
-
source/lib/res/h_mgr.h
384 384 extern Status h_free(Handle& h, H_Type type); 385 385 386 386 387 // Forcibly frees all handles of a specified type. 388 void h_mgr_free_type(const H_Type type); 389 390 387 391 // find and return a handle by key (typically filename hash) 388 392 // currently O(log n). 389 393 // -
source/lib/res/h_mgr.cpp
787 787 pool_destroy(&hpool); 788 788 } 789 789 790 void h_mgr_free_type(const H_Type type) 791 { 792 ignoreDoubleFree = true; 790 793 794 H_ScopedLock s; 795 796 // forcibly close all open handles of the specified type 797 for(HDATA* hd = (HDATA*)hpool.da.base; hd < (HDATA*)(hpool.da.base + hpool.da.pos); hd = (HDATA*)(uintptr_t(hd)+hpool.el_size)) 798 { 799 // free if not previously freed and only free the proper type 800 if (hd->key == 0 || hd->type != type) 801 continue; 802 803 // disable caching; we need to release the resource now. 804 hd->keep_open = 0; 805 hd->refs = 0; 806 807 h_free_hd(hd); 808 } 809 } 810 791 811 void h_mgr_init() 792 812 { 793 813 ModuleInit(&initState, Init); -
source/lib/res/graphics/cursor.cpp
295 295 return h_alloc(H_Cursor, vfs, name, 0, (int)forceGL); 296 296 } 297 297 298 void cursor_shutdown() 299 { 300 h_mgr_free_type(H_Cursor); 301 } 302 298 303 static Status cursor_free(Handle& h) 299 304 { 300 305 return h_free(h, H_Cursor); -
source/lib/res/graphics/cursor.h
46 46 **/ 47 47 extern Status cursor_draw(const PIVFS& vfs, const wchar_t* name, int x, int y, bool forceGL); 48 48 49 /** 50 * Forcibly frees all cursor handles. 51 * 52 * Currently used just prior to SDL shutdown. 53 */ 54 void cursor_shutdown(); 55 49 56 #endif // #ifndef INCLUDED_GRAPHICS_CURSOR -
source/ps/GameSetup/GameSetup.cpp
636 636 637 637 static void ShutdownSDL() 638 638 { 639 // Free cursors before shutting down SDL, as they may depend on SDL. 640 cursor_shutdown(); 641 639 642 SDL_Quit(); 640 643 sys_cursor_reset(); 641 644 }