Skip to content

Commit 87d07c9

Browse files
committed
Merge pull request #472 from ln-zookeeper/bm_unlock_unload_fixes
Fixes to some bm_unlock and bm_unload calls
2 parents 2bd78ee + 407a235 commit 87d07c9

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

code/bmpman/bmpman.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1506,8 +1506,8 @@ bitmap * bm_lock(int handle, ubyte bpp, ubyte flags, bool nodebug) {
15061506
// read the file data
15071507
if (gr_bm_lock(be->filename, handle, bitmapnum, bpp, flags, nodebug) == -1) {
15081508
// oops, this isn't good - reset and return NULL
1509-
bm_unlock(bitmapnum);
1510-
bm_unload(bitmapnum);
1509+
bm_unlock( handle );
1510+
bm_unload( handle );
15111511

15121512
return NULL;
15131513
}
@@ -2100,7 +2100,9 @@ void bm_page_in_stop() {
21002100
}
21012101
} else {
21022102
bm_lock(bm_bitmaps[i].handle, (bm_bitmaps[i].used_flags == BMP_AABITMAP) ? 8 : 16, bm_bitmaps[i].used_flags);
2103-
bm_unlock(bm_bitmaps[i].handle);
2103+
if (bm_bitmaps[i].ref_count >= 1) {
2104+
bm_unlock( bm_bitmaps[i].handle );
2105+
}
21042106
}
21052107

21062108
n++;

0 commit comments

Comments
 (0)