mirror of
https://github.com/tuxbox-neutrino/neutrino.git
synced 2025-08-28 16:01:20 +02:00
hourglass: fix segfault, repeatable with: for(int i = 1; i < 10000; i++){hg.paint();hg.hide();}
This commit is contained in:
@@ -70,8 +70,11 @@ CHourGlass::CHourGlass( const int x_pos,
|
||||
|
||||
CHourGlass::~CHourGlass()
|
||||
{
|
||||
delete hg_timer;
|
||||
hg_timer = NULL;
|
||||
if(hg_timer)
|
||||
{
|
||||
delete hg_timer;
|
||||
hg_timer = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
void CHourGlass::initImageFiles()
|
||||
@@ -101,6 +104,8 @@ void CHourGlass::paint(const bool &do_save_bg)
|
||||
if (hg_img_files.empty())
|
||||
return;
|
||||
|
||||
std::lock_guard<std::mutex> g(hg_mutex);
|
||||
|
||||
if (hg_file_num > hg_img_files.size()-1)
|
||||
hg_file_num = 0;
|
||||
|
||||
|
@@ -43,7 +43,7 @@ class CHourGlass : public CComponentsShapeSquare
|
||||
int64_t hg_interval;
|
||||
CComponentsTimer *hg_timer;
|
||||
size_t hg_file_num;
|
||||
|
||||
std::mutex hg_mutex;
|
||||
void initImageFiles();
|
||||
public:
|
||||
/**CHourGlass Constructor
|
||||
|
Reference in New Issue
Block a user