fixed: thread locking problem in Image: method Lock() was used instead of Winix::Lock object

This commit is contained in:
Tomasz Sowa 2021-04-10 19:46:50 +02:00
parent 486067a4b2
commit 0e0c006d5a
1 changed files with 8 additions and 22 deletions

View File

@ -267,7 +267,7 @@ bool end;
do
{
class Lock lock_object(synchro);
Winix::Lock lock_object(synchro);
if( i != image_tab.end() )
{
@ -412,18 +412,13 @@ void Image::CreateTmpFileName()
// second thread (objects are not locked)
bool Image::CreateCommand()
{
class Lock lock_object(synchro);
Winix::Lock lock_object(synchro);
// iq.SetAll(true, false);
// iq.WhereId(item_work.file_id);
morm::Finder<Item> finder(model_connector);
{
// IMPROVEME we need a seperate model_connector for this thread
Lock();
file_work = finder.select().where().eq(L"id", item_work.file_id).get();
}
file_work = finder.select().where().eq(L"id", item_work.file_id).get();
// the file could have been changed especially when there is a long queue of files
if( !file_work.found() )
@ -495,13 +490,9 @@ void Image::ImageSavedCorrectly()
{
file_work.item_content.file_has_thumb = true;
{
// IMPROVEME we need a separate model_connector for this thread
Lock();
file_work.propagate_connector();
file_work.item_content.update(false);
//db->EditHasThumbById(true, file_work.id);
}
file_work.propagate_connector();
file_work.item_content.update(false);
//db->EditHasThumbById(true, file_work.id);
}
log << log3 << "Image: generated a thumbnail: " << dst_path << logend;
@ -540,19 +531,15 @@ void Image::ImageSavedCorrectly()
// second thread (objects are not locked)
void Image::SaveImage()
{
class Lock lock_object(synchro);
Winix::Lock lock_object(synchro);
// the file could have been changed especially when creating the image lasted too long
//iq.SetAll(true, false);
//iq.WhereId(item_work.file_id);
morm::Finder<Item> finder(model_connector);
file_work = finder.select().where().eq(L"id", item_work.file_id).get();
{
// IMPROVEME we need a seperate model_connector for this thread
Lock();
file_work = finder.select().where().eq(L"id", item_work.file_id).get();
}
// the file could have been changed especially when there is a long queue of files
if( !file_work.found() )
@ -603,7 +590,6 @@ void Image::CreateImage()
}
else
{
class Lock lock_object(synchro);
log << log3 << "Image: some problems with creating an image"
<< ", 'convert' process returned: " << res << logend;
}