added the new token service in more funcitons and resolved the crash on posting a pulse

This commit is contained in:
PYRET1C 2023-12-15 00:05:41 +05:30
parent 5433e85323
commit b9e7bb5457
3 changed files with 21 additions and 16 deletions

View File

@ -103,10 +103,9 @@ void PulseAddDialog::setGroup(const RsGxsGroupId &grpId)
return; return;
} }
RsThread::async([this,grpId](){
RsWireGroupSPtr pGroup; RsWireGroupSPtr pGroup;
RsThread::async([this,grpId,&pGroup](){
if(!rsWire->getWireGroup(grpId,pGroup)) if(!rsWire->getWireGroup(grpId,pGroup))
{ {
std::cerr << __PRETTY_FUNCTION__ << " failed to retrieve wire group info for wire id: " << grpId << std::endl; std::cerr << __PRETTY_FUNCTION__ << " failed to retrieve wire group info for wire id: " << grpId << std::endl;
@ -260,11 +259,11 @@ void PulseAddDialog::setReplyTo(const RsGxsGroupId &grpId, const RsGxsMessageId
return; return;
} }
/* fetch in the background */ /* fetch in the background */
RsThread::async([this,grpId,msgId,replyType](){
RsWireGroupSPtr pGroup; RsWireGroupSPtr pGroup;
RsWirePulseSPtr pPulse; RsWirePulseSPtr pPulse;
RsThread::async([this,grpId,&pGroup,&pPulse,msgId,replyType](){
if(!rsWire->getWireGroup(grpId,pGroup)) if(!rsWire->getWireGroup(grpId,pGroup))
{ {
std::cerr << __PRETTY_FUNCTION__ << "PulseAddDialog::setRplyTo() failed to fetch group id: " << grpId << std::endl; std::cerr << __PRETTY_FUNCTION__ << "PulseAddDialog::setRplyTo() failed to fetch group id: " << grpId << std::endl;
@ -345,7 +344,7 @@ void PulseAddDialog::postOriginalPulse()
std::cerr << "PulseAddDialog::postOriginalPulse()"; std::cerr << "PulseAddDialog::postOriginalPulse()";
std::cerr << std::endl; std::cerr << std::endl;
RsWirePulseSPtr pPulse; RsWirePulseSPtr pPulse(new RsWirePulse());
pPulse->mSentiment = WIRE_PULSE_SENTIMENT_NO_SENTIMENT; pPulse->mSentiment = WIRE_PULSE_SENTIMENT_NO_SENTIMENT;
pPulse->mPulseText = ui.textEdit_Pulse->toPlainText().toStdString(); pPulse->mPulseText = ui.textEdit_Pulse->toPlainText().toStdString();
@ -407,7 +406,7 @@ void PulseAddDialog::postReplyPulse()
std::cerr << "PulseAddDialog::postReplyPulse()"; std::cerr << "PulseAddDialog::postReplyPulse()";
std::cerr << std::endl; std::cerr << std::endl;
RsWirePulseSPtr pPulse; RsWirePulseSPtr pPulse(new RsWirePulse());
pPulse->mSentiment = toPulseSentiment(ui.comboBox_sentiment->currentIndex()); pPulse->mSentiment = toPulseSentiment(ui.comboBox_sentiment->currentIndex());
pPulse->mPulseText = ui.textEdit_Pulse->toPlainText().toStdString(); pPulse->mPulseText = ui.textEdit_Pulse->toPlainText().toStdString();

View File

@ -140,6 +140,7 @@ WireDialog::~WireDialog()
processSettings(false); processSettings(false);
clearTwitterView(); clearTwitterView();
std::cerr << "WireDialog::~WireDialog()" << std::endl;
delete(mWireQueue); delete(mWireQueue);
rsEvents->unregisterEventsHandler(mEventHandlerId); rsEvents->unregisterEventsHandler(mEventHandlerId);
@ -681,6 +682,7 @@ void WireDialog::PVHrate(const RsGxsId &authorId)
void WireDialog::postTestTwitterView() void WireDialog::postTestTwitterView()
{ {
clearTwitterView(); clearTwitterView();
std::cerr << "WireDialog::postTestTwitterView()" << std::endl;
addTwitterView(new PulseTopLevel(NULL,RsWirePulseSPtr())); addTwitterView(new PulseTopLevel(NULL,RsWirePulseSPtr()));
addTwitterView(new PulseReply(NULL,RsWirePulseSPtr())); addTwitterView(new PulseReply(NULL,RsWirePulseSPtr()));
@ -837,6 +839,7 @@ void WireDialog::requestPulseFocus(const RsGxsGroupId groupId, const RsGxsMessag
void WireDialog::showPulseFocus(const RsGxsGroupId groupId, const RsGxsMessageId msgId) void WireDialog::showPulseFocus(const RsGxsGroupId groupId, const RsGxsMessageId msgId)
{ {
clearTwitterView(); clearTwitterView();
std::cerr << "WireDialog::showPulseFocus()" << std::endl;
// background thread for loading. // background thread for loading.
RsThread::async([this, groupId, msgId]() RsThread::async([this, groupId, msgId]()
@ -866,6 +869,8 @@ void WireDialog::showPulseFocus(const RsGxsGroupId groupId, const RsGxsMessageId
void WireDialog::postPulseFocus(RsWirePulseSPtr pPulse) void WireDialog::postPulseFocus(RsWirePulseSPtr pPulse)
{ {
clearTwitterView(); clearTwitterView();
std::cerr << "WireDialog::postPulseFocus()" << std::endl;
if (!pPulse) if (!pPulse)
{ {
std::cerr << "WireDialog::postPulseFocus() Invalid pulse"; std::cerr << "WireDialog::postPulseFocus() Invalid pulse";
@ -938,7 +943,7 @@ void WireDialog::requestGroupFocus(const RsGxsGroupId groupId)
void WireDialog::showGroupFocus(const RsGxsGroupId groupId) void WireDialog::showGroupFocus(const RsGxsGroupId groupId)
{ {
clearTwitterView(); clearTwitterView();
std::cerr << "WireDialog::showGroupFocus()" << std::endl;
// background thread for loading. // background thread for loading.
RsThread::async([this, groupId]() RsThread::async([this, groupId]()
{ {
@ -1015,6 +1020,7 @@ void WireDialog::requestGroupsPulses(const std::list<RsGxsGroupId>& groupIds)
void WireDialog::showGroupsPulses(const std::list<RsGxsGroupId>& groupIds) void WireDialog::showGroupsPulses(const std::list<RsGxsGroupId>& groupIds)
{ {
clearTwitterView(); clearTwitterView();
std::cerr << "WireDialog::showGroupPulses()" << std::endl;
// background thread for loading. // background thread for loading.
RsThread::async([this, groupIds]() RsThread::async([this, groupIds]()