mirror of
https://github.com/tuxbox-neutrino/neutrino.git
synced 2025-08-29 08:21:12 +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()
|
CHourGlass::~CHourGlass()
|
||||||
{
|
{
|
||||||
|
if(hg_timer)
|
||||||
|
{
|
||||||
delete hg_timer;
|
delete hg_timer;
|
||||||
hg_timer = NULL;
|
hg_timer = NULL;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CHourGlass::initImageFiles()
|
void CHourGlass::initImageFiles()
|
||||||
@@ -101,6 +104,8 @@ void CHourGlass::paint(const bool &do_save_bg)
|
|||||||
if (hg_img_files.empty())
|
if (hg_img_files.empty())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
std::lock_guard<std::mutex> g(hg_mutex);
|
||||||
|
|
||||||
if (hg_file_num > hg_img_files.size()-1)
|
if (hg_file_num > hg_img_files.size()-1)
|
||||||
hg_file_num = 0;
|
hg_file_num = 0;
|
||||||
|
|
||||||
|
@@ -43,7 +43,7 @@ class CHourGlass : public CComponentsShapeSquare
|
|||||||
int64_t hg_interval;
|
int64_t hg_interval;
|
||||||
CComponentsTimer *hg_timer;
|
CComponentsTimer *hg_timer;
|
||||||
size_t hg_file_num;
|
size_t hg_file_num;
|
||||||
|
std::mutex hg_mutex;
|
||||||
void initImageFiles();
|
void initImageFiles();
|
||||||
public:
|
public:
|
||||||
/**CHourGlass Constructor
|
/**CHourGlass Constructor
|
||||||
|
Reference in New Issue
Block a user