Skip to content

Commit a793f42

Browse files
committed
Restore clean shutdown
1 parent aefbd1b commit a793f42

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

ahab.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -79,8 +79,8 @@ int main( int argc, char *argv[] )
7979

8080
try {
8181
delete xevents;
82-
delete decoder;
8382
delete controller;
83+
delete decoder;
8484
delete display;
8585
delete stream;
8686
delete file;

framebuffer.cpp

+13-1
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,28 @@ BufferPool::BufferPool( uint s_num_frames, uint mb_width, uint mb_height )
1717
}
1818

1919
unixassert( pthread_mutex_init( &mutex, NULL ) );
20+
unixassert( pthread_cond_init( &activity, NULL ) );
2021
}
2122

2223
BufferPool::~BufferPool()
2324
{
25+
Frame *frame;
26+
27+
do {
28+
frame = free.dequeue( false );
29+
} while ( frame );
30+
31+
do {
32+
frame = freeable.dequeue( false );
33+
} while ( frame );
34+
2435
for ( uint i = 0; i < num_frames; i++ ) {
25-
Frame *frame = frames[ i ];
36+
frame = frames[ i ];
2637
delete frame;
2738
}
2839
delete[] frames;
2940

41+
unixassert( pthread_cond_destroy( &activity ) );
3042
unixassert( pthread_mutex_destroy( &mutex ) );
3143
}
3244

0 commit comments

Comments
 (0)