Merge pull request #2236 from csoler/v0.6-BugFixing_5

Bug fixing for 0.6.6
This commit is contained in:
csoler 2021-01-21 15:34:39 +01:00 committed by GitHub
commit 1b62cd2750
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 58 additions and 19 deletions

View File

@ -2519,7 +2519,7 @@ void RsGenExchange::processGroupUpdatePublish()
{ {
GroupUpdatePublish& gup = *vit; GroupUpdatePublish& gup = *vit;
const RsGxsGroupId& groupId = gup.grpItem->meta.mGroupId; const RsGxsGroupId& groupId = gup.grpItem->meta.mGroupId;
grpMeta.insert(std::make_pair(groupId, (RsGxsGrpMetaData*)(NULL))); grpMeta.insert(std::make_pair(groupId, std::make_shared<RsGxsGrpMetaData>()));
} }
if(grpMeta.empty()) if(grpMeta.empty())
@ -2985,7 +2985,7 @@ bool RsGenExchange::getGroupKeys(const RsGxsGroupId &grpId, RsTlvSecurityKeySet
RS_STACK_MUTEX(mGenMtx) ; RS_STACK_MUTEX(mGenMtx) ;
RsGxsGrpMetaTemporaryMap grpMeta; RsGxsGrpMetaTemporaryMap grpMeta;
grpMeta[grpId] = NULL; grpMeta[grpId] = std::make_shared<RsGxsGrpMetaData>();
mDataStore->retrieveGxsGrpMetaData(grpMeta); mDataStore->retrieveGxsGrpMetaData(grpMeta);
if(grpMeta.empty()) if(grpMeta.empty())
@ -3078,7 +3078,7 @@ void RsGenExchange::processRecvdMessages()
} }
else else
{ {
grpMetas.insert(std::make_pair(pend_it->second.mItem->grpId, (RsGxsGrpMetaData*)NULL)); grpMetas.insert(std::make_pair(pend_it->second.mItem->grpId, std::make_shared<RsGxsGrpMetaData>()));
++pend_it; ++pend_it;
} }
} }

View File

@ -766,7 +766,12 @@ void RsGxsNetTunnelService::threadTick()
} }
#endif #endif
rstime::rs_usleep(1*1000*1000) ; // 1 sec for(uint32_t i=0;i<2;++i)
{
if(shouldStop())
return;
rstime::rs_usleep(500*1000) ; // 1 sec
}
} }
const Bias20Bytes& RsGxsNetTunnelService::locked_randomBias() const Bias20Bytes& RsGxsNetTunnelService::locked_randomBias()

View File

@ -141,8 +141,6 @@ void BroadcastDiscoveryService::updatePublishedData()
void BroadcastDiscoveryService::threadTick() void BroadcastDiscoveryService::threadTick()
{ {
auto nextRunAt = std::chrono::system_clock::now() + std::chrono::seconds(5);
if( mUdcParameters.can_discover() && if( mUdcParameters.can_discover() &&
!mRsPeers.isHiddenNode(mRsPeers.getOwnId()) ) !mRsPeers.isHiddenNode(mRsPeers.getOwnId()) )
{ {
@ -200,7 +198,13 @@ void BroadcastDiscoveryService::threadTick()
if( mUdcParameters.can_be_discovered() && if( mUdcParameters.can_be_discovered() &&
!mRsPeers.isHiddenNode(mRsPeers.getOwnId()) ) updatePublishedData(); !mRsPeers.isHiddenNode(mRsPeers.getOwnId()) ) updatePublishedData();
std::this_thread::sleep_until(nextRunAt); // This avoids waiting 5 secs when the thread should actually terminate (when RS closes).
for(uint32_t i=0;i<10;++i)
{
if(shouldStop())
return;
rstime::rs_usleep(500*1000); // sleep for 0.5 sec.
}
} }
RsBroadcastDiscoveryResult BroadcastDiscoveryService::createResult( RsBroadcastDiscoveryResult BroadcastDiscoveryService::createResult(

View File

@ -93,13 +93,17 @@ p3GxsChannels::p3GxsChannels(
mLastDistantSearchNotificationTS = 0; mLastDistantSearchNotificationTS = 0;
mCommentService = new p3GxsCommentService(this, RS_SERVICE_GXS_TYPE_CHANNELS); mCommentService = new p3GxsCommentService(this, RS_SERVICE_GXS_TYPE_CHANNELS);
RsTickEvent::schedule_in(CHANNEL_PROCESS, 0); // This is not needed since it just loads all channel data ever 5 mins which takes a lot
// of useless CPU/memory.
//
// RsTickEvent::schedule_in(CHANNEL_PROCESS, 0);
//
// Test Data disabled in repo. // Test Data disabled in repo.
//RsTickEvent::schedule_in(CHANNEL_TESTEVENT_DUMMYDATA, DUMMYDATA_PERIOD); //
// RsTickEvent::schedule_in(CHANNEL_TESTEVENT_DUMMYDATA, DUMMYDATA_PERIOD);
mGenToken = 0; mGenToken = 0;
mGenCount = 0; mGenCount = 0;
} }

View File

@ -643,6 +643,7 @@ void p3IdService::notifyChanges(std::vector<RsGxsNotify *> &changes)
case RsGxsNotify::TYPE_PROCESSED: break ; // Happens when the group is subscribed. This is triggered by RsGenExchange::subscribeToGroup, so better not case RsGxsNotify::TYPE_PROCESSED: break ; // Happens when the group is subscribed. This is triggered by RsGenExchange::subscribeToGroup, so better not
// call it again from here!! // call it again from here!!
case RsGxsNotify::TYPE_UPDATED:
case RsGxsNotify::TYPE_PUBLISHED: case RsGxsNotify::TYPE_PUBLISHED:
{ {
auto ev = std::make_shared<RsGxsIdentityEvent>(); auto ev = std::make_shared<RsGxsIdentityEvent>();

View File

@ -20,6 +20,7 @@
#include <QBuffer> #include <QBuffer>
#include <QMessageBox> #include <QMessageBox>
#include <QToolTip>
#include "IdEditDialog.h" #include "IdEditDialog.h"
#include "ui_IdEditDialog.h" #include "ui_IdEditDialog.h"
@ -100,6 +101,7 @@ IdEditDialog::~IdEditDialog() {}
void IdEditDialog::changeAvatar() void IdEditDialog::changeAvatar()
{ {
#ifdef TODO
AvatarDialog dialog(this); AvatarDialog dialog(this);
dialog.setAvatar(mAvatar); dialog.setAvatar(mAvatar);
@ -109,6 +111,23 @@ void IdEditDialog::changeAvatar()
setAvatar(newAvatar); setAvatar(newAvatar);
} }
#endif
// For now we use a simpler method since AvatarDialog is not finished yet; we use the thumbnail viewer to allow the user to
// select a proper scale/crop of a given image to make his/her avatar.
QString image_filename ;
if(!misc::getOpenFileName(this,RshareSettings::LASTDIR_IMAGES,tr("Import image"), tr("Image files (*.jpg *.png);;All files (*)"),image_filename))
return;
QImage img(image_filename);
ui->avatarLabel->setPicture(QPixmap::fromImage(img));
ui->avatarLabel->setEnableZoom(true);
ui->avatarLabel->setToolTip(tr("Use the mouse to zoom and adjust the image for your avatar."));
// shows the tooltip for a while
QToolTip::showText( ui->avatarLabel->mapToGlobal( QPoint( 0, 0 ) ), ui->avatarLabel->toolTip() );
} }
void IdEditDialog::setupNewId(bool pseudo,bool enable_anon) void IdEditDialog::setupNewId(bool pseudo,bool enable_anon)
@ -598,6 +617,8 @@ void IdEditDialog::updateId()
mEditGroup.mMeta.mGroupName = groupname.toUtf8().constData(); mEditGroup.mMeta.mGroupName = groupname.toUtf8().constData();
mAvatar = ui->avatarLabel->extractCroppedScaledPicture();
if (!mAvatar.isNull()) if (!mAvatar.isNull())
{ {
QByteArray ba; QByteArray ba;

View File

@ -6,8 +6,8 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>542</width> <width>593</width>
<height>536</height> <height>604</height>
</rect> </rect>
</property> </property>
<property name="sizePolicy"> <property name="sizePolicy">
@ -291,7 +291,7 @@
<item> <item>
<layout class="QVBoxLayout" name="avatarVLayout"> <layout class="QVBoxLayout" name="avatarVLayout">
<item> <item>
<widget class="QLabel" name="avatarLabel"> <widget class="ZoomableLabel" name="avatarLabel">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed"> <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch> <horstretch>0</horstretch>
@ -330,7 +330,7 @@
<item> <item>
<widget class="QPushButton" name="avatarButton"> <widget class="QPushButton" name="avatarButton">
<property name="text"> <property name="text">
<string>Set Avatar</string> <string>Choose image...</string>
</property> </property>
</widget> </widget>
</item> </item>
@ -529,9 +529,13 @@
<header>gui/common/HeaderFrame.h</header> <header>gui/common/HeaderFrame.h</header>
<container>1</container> <container>1</container>
</customwidget> </customwidget>
<customwidget>
<class>ZoomableLabel</class>
<extends>QLabel</extends>
<header>gui/gxschannels/GxsChannelPostThumbnail.h</header>
</customwidget>
</customwidgets> </customwidgets>
<resources> <resources>
<include location="../images.qrc"/>
<include location="../icons.qrc"/> <include location="../icons.qrc"/>
</resources> </resources>
<connections/> <connections/>

View File

@ -376,9 +376,10 @@ MainWindow::~MainWindow()
delete toasterDisable; delete toasterDisable;
delete sysTrayStatus; delete sysTrayStatus;
delete trayIcon; delete trayIcon;
delete notifyMenu;//notifyMenu belongs to trayMenu
delete trayMenu; delete trayMenu;
StatisticsWindow::releaseInstance(); // delete notifyMenu; // already deleted by the deletion of trayMenu
StatisticsWindow::releaseInstance();
#ifdef MESSENGER_WINDOW #ifdef MESSENGER_WINDOW
MessengerWindow::releaseInstance(); MessengerWindow::releaseInstance();
#endif #endif

View File

@ -669,7 +669,6 @@ void GxsChannelPostsWidgetWithModel::download()
for(auto& file:post.mFiles) for(auto& file:post.mFiles)
{ {
std::list<RsPeerId> sources; std::list<RsPeerId> sources;
std::string destination;
// Add possible direct sources. // Add possible direct sources.
FileInfo fileInfo; FileInfo fileInfo;