[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-finance-apps
Subject:    Re: GSoC '21 KMyMoney : I am stuck.
From:       Suraj Kumar Mahto <suraj.mahto49 () gmail ! com>
Date:       2021-06-23 19:59:37
Message-ID: CAEDvbQD8xRbBBAW0U6rOa4nNfQjdLN2GUJ4g78rN_cZC2KxE_g () mail ! gmail ! com
[Download RAW message or body]

> Yes, the problem is, that the profile argument to the AlkOnlineQuoteSource
> ctor is a nullptr. This is then used and the crash happens. The cause to
> this is, that in AlkOnlineQuotesWidget::Private::slotNewEntry() the
> m_profile member is not initialized (nullptr). An assignment happens in
> AlkOnlineQuotesWidget::Private::loadProfiles() and
> AlkOnlineQuotesWidget::Private::slotLoadProfile() but the list of profiles
> in your case seems to be empty, and thus no profile is assigned.

> See MainWindow::MainWindow in onlinequoteseditor.cpp which is part of
alkimia
> how to load an initial profile which you should do if the list is empty.

In alkonlinequoteswidget.cpp (loadProfile() and slotLoadProfile())- I added
such in case for an empty list, taken from
tools/onlinequoteseditor/mainwindow.cpp (I guess you were referring that
instead of onlinequoteseditor.cpp)
    if (list.isEmpty()){
        AlkOnlineQuotesProfileManager &manager =
AlkOnlineQuotesProfileManager::instance();

        manager.addProfile(new AlkOnlineQuotesProfile("no-config-file",
AlkOnlineQuotesProfile::Type::None));
        #if QT_VERSION < QT_VERSION_CHECK(5,0,0)
            manager.addProfile(new AlkOnlineQuotesProfile("alkimia4",
AlkOnlineQuotesProfile::Type::Alkimia4, "alkimia-quotes.knsrc"));
            manager.addProfile(new AlkOnlineQuotesProfile("skrooge4",
AlkOnlineQuotesProfile::Type::Skrooge4, "skrooge-quotes.knsrc"));
            manager.addProfile(new AlkOnlineQuotesProfile("kmymoney4",
AlkOnlineQuotesProfile::Type::KMyMoney4, "kmymoney-quotes.knsrc"));
        #else
            manager.addProfile(new AlkOnlineQuotesProfile("alkimia5",
AlkOnlineQuotesProfile::Type::Alkimia5, "alkimia-quotes.knsrc"));
            manager.addProfile(new AlkOnlineQuotesProfile("skrooge5",
AlkOnlineQuotesProfile::Type::Skrooge5, "skrooge-quotes.knsrc"));
            manager.addProfile(new AlkOnlineQuotesProfile("kmymoney5",
AlkOnlineQuotesProfile::Type::KMyMoney5, "kmymoney-quotes.knsrc"));
        #endif
        #ifdef ENABLE_FINANCEQUOTE
            manager.addProfile(new AlkOnlineQuotesProfile("Finance::Quote",
AlkOnlineQuotesProfile::Type::Script));
        #endif

        m_profile->manager();
        return;
    }

Also in order to use my local cloned version of libalkimia in kmymoney
rather than the installed one in /usr/ . I just imported that in
ksettingskmymoney.cpp as
#include </path/to/local/cloned/libalkimia/alkonlinequoteswidget.h> Am I
doing this right? Because I am still getting the crash :(

Regards
Suraj Kumar Mahto

On Wed, Jun 23, 2021 at 11:11 AM Thomas Baumgart <thb@net-bembel.de> wrote:

> Suraj,
>
> On Dienstag, 22. Juni 2021 21:45:59 CEST Suraj Kumar Mahto wrote:
>
> > > Look at the local variables. What is the value of 'this'? Does that
> make
> > sense?
> > > It chokes inside the method AlkOnlineQuotesProfile::type() which gets
> > called
> > > from AlkOnlineQuoteSource ctor in line 230. Which object is pointed to
> > when
> > > calling type()? Which value does this pointer have? Where is it
> > initialized?
> >
> > After days of bug hunting, I couldn't figure out that. The following
> things
> > I did for the same.
> > - I stepped in through functions in debugging and checked the stack.
> > - Tried to study the QMap related function defaultQuoteSources() and
> > checked its usage.
> > - While experimenting with the alkimia lib I found that after executing
> the
> > onlinequoteseditor5 binary separately(in build/bin/) the widget works
> fine
> > and there is no crash while interacting with the UI like buttons and
> fields
> > as opposed to what I saw in the kmymoney.
>
> Yes, the problem is, that the profile argument to the AlkOnlineQuoteSource
> ctor is a nullptr. This is then used and the crash happens. The cause to
> this is, that in AlkOnlineQuotesWidget::Private::slotNewEntry() the
> m_profile member is not initialized (nullptr). An assignment happens in
> AlkOnlineQuotesWidget::Private::loadProfiles() and
> AlkOnlineQuotesWidget::Private::slotLoadProfile() but the list of profiles
> in your case seems to be empty, and thus no profile is assigned.
>
> See MainWindow::MainWindow in onlinequoteseditor.cpp which is part of
> alkimia
> how to load an initial profile which you should do if the list is empty.
>
> > Please direct me what thing I missed. Thanks.
> > Sorry for the delay in the blog post. I planned for week 1-2 blog by
> Monday
> > only. I thought that I will post that after solving this bug.
>
> OK.
>
> --
>
> Regards
>
> Thomas Baumgart
>
> https://www.signal.org/       Signal, the better WhatsApp
> -------------------------------------------------------------
> 'Knowing a computer language is neither a necessary nor a sufficient
> condition to know how to construct a computer program' -- J.R. Tyrer
> -------------------------------------------------------------
>

[Attachment #3 (text/html)]

<div dir="ltr"><div><span class="gmail-im"></span>&gt; Yes, the problem is, that the \
profile argument to the AlkOnlineQuoteSource<br> &gt; ctor is a nullptr. This is then \
used and the crash happens. The cause to<br> &gt; this is, that in \
AlkOnlineQuotesWidget::Private::slotNewEntry() the<br> &gt; m_profile member is not \
initialized (nullptr). An assignment happens in<br> &gt; \
AlkOnlineQuotesWidget::Private::loadProfiles() and <br>&gt; \
AlkOnlineQuotesWidget::Private::slotLoadProfile() but the list of profiles<br> &gt; \
in your case seems to be empty, and thus no profile is assigned.<br> <br>
&gt; See MainWindow::MainWindow in onlinequoteseditor.cpp which is part of \
alkimia<br> &gt; how to load an initial profile which you should do if the list is \
empty.<span class="gmail-im"><br><br></span></div><span class="gmail-im">In \
alkonlinequoteswidget.cpp (loadProfile() and slotLoadProfile())- I added such in case \
for an empty list, taken from tools/onlinequoteseditor/mainwindow.cpp (I guess you \
were referring that instead of onlinequoteseditor.cpp)<br>      if \
(list.isEmpty()){<br>            AlkOnlineQuotesProfileManager &amp;manager = \
AlkOnlineQuotesProfileManager::instance();<br><br>            manager.addProfile(new \
AlkOnlineQuotesProfile(&quot;no-config-file&quot;, \
AlkOnlineQuotesProfile::Type::None));<br>            #if QT_VERSION &lt; \
QT_VERSION_CHECK(5,0,0)<br>                  manager.addProfile(new \
AlkOnlineQuotesProfile(&quot;alkimia4&quot;, AlkOnlineQuotesProfile::Type::Alkimia4, \
&quot;alkimia-quotes.knsrc&quot;));<br>                  manager.addProfile(new \
AlkOnlineQuotesProfile(&quot;skrooge4&quot;, AlkOnlineQuotesProfile::Type::Skrooge4, \
&quot;skrooge-quotes.knsrc&quot;));<br>                  manager.addProfile(new \
AlkOnlineQuotesProfile(&quot;kmymoney4&quot;, \
AlkOnlineQuotesProfile::Type::KMyMoney4, &quot;kmymoney-quotes.knsrc&quot;));<br>     \
#else<br>                  manager.addProfile(new \
AlkOnlineQuotesProfile(&quot;alkimia5&quot;, AlkOnlineQuotesProfile::Type::Alkimia5, \
&quot;alkimia-quotes.knsrc&quot;));<br>                  manager.addProfile(new \
AlkOnlineQuotesProfile(&quot;skrooge5&quot;, AlkOnlineQuotesProfile::Type::Skrooge5, \
&quot;skrooge-quotes.knsrc&quot;));<br>                  manager.addProfile(new \
AlkOnlineQuotesProfile(&quot;kmymoney5&quot;, \
AlkOnlineQuotesProfile::Type::KMyMoney5, &quot;kmymoney-quotes.knsrc&quot;));<br>     \
#endif<br>            #ifdef ENABLE_FINANCEQUOTE<br>                  \
manager.addProfile(new AlkOnlineQuotesProfile(&quot;Finance::Quote&quot;, \
AlkOnlineQuotesProfile::Type::Script));<br>            #endif<br><br>            \
m_profile-&gt;manager();<br>            return;<br>      }</span><div><div><div><span \
class="gmail-im"><br></span></div><div><span class="gmail-im">Also in order to use my \
local cloned version of libalkimia in kmymoney rather than the installed one in /usr/ \
. I just imported that in ksettingskmymoney.cpp as<br>#include \
&lt;/path/to/local/cloned/libalkimia/alkonlinequoteswidget.h&gt; Am I doing this \
right? Because I am still getting the crash :(<br><br></span></div><div><span \
class="gmail-im">Regards<br></span></div><div><span class="gmail-im">Suraj Kumar \
Mahto<br></span></div><div></div></div></div></div><br><div class="gmail_quote"><div \
dir="ltr" class="gmail_attr">On Wed, Jun 23, 2021 at 11:11 AM Thomas Baumgart &lt;<a \
href="mailto:thb@net-bembel.de">thb@net-bembel.de</a>&gt; wrote:<br></div><blockquote \
class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid \
rgb(204,204,204);padding-left:1ex">Suraj,<br> <br>
On Dienstag, 22. Juni 2021 21:45:59 CEST Suraj Kumar Mahto wrote:<br>
<br>
&gt; &gt; Look at the local variables. What is the value of &#39;this&#39;? Does that \
make<br> &gt; sense?<br>
&gt; &gt; It chokes inside the method AlkOnlineQuotesProfile::type() which gets<br>
&gt; called<br>
&gt; &gt; from AlkOnlineQuoteSource ctor in line 230. Which object is pointed to<br>
&gt; when<br>
&gt; &gt; calling type()? Which value does this pointer have? Where is it<br>
&gt; initialized?<br>
&gt; <br>
&gt; After days of bug hunting, I couldn&#39;t figure out that. The following \
things<br> &gt; I did for the same.<br>
&gt; - I stepped in through functions in debugging and checked the stack.<br>
&gt; - Tried to study the QMap related function defaultQuoteSources() and<br>
&gt; checked its usage.<br>
&gt; - While experimenting with the alkimia lib I found that after executing the<br>
&gt; onlinequoteseditor5 binary separately(in build/bin/) the widget works fine<br>
&gt; and there is no crash while interacting with the UI like buttons and fields<br>
&gt; as opposed to what I saw in the kmymoney.<br>
<br>
Yes, the problem is, that the profile argument to the AlkOnlineQuoteSource<br>
ctor is a nullptr. This is then used and the crash happens. The cause to<br>
this is, that in AlkOnlineQuotesWidget::Private::slotNewEntry() the<br>
m_profile member is not initialized (nullptr). An assignment happens in<br>
AlkOnlineQuotesWidget::Private::loadProfiles() and <br>
AlkOnlineQuotesWidget::Private::slotLoadProfile() but the list of profiles<br>
in your case seems to be empty, and thus no profile is assigned.<br>
<br>
See MainWindow::MainWindow in onlinequoteseditor.cpp which is part of alkimia<br>
how to load an initial profile which you should do if the list is empty.<br>
<br>
&gt; Please direct me what thing I missed. Thanks.<br>
&gt; Sorry for the delay in the blog post. I planned for week 1-2 blog by Monday<br>
&gt; only. I thought that I will post that after solving this bug.<br>
<br>
OK.<br>
<br>
-- <br>
<br>
Regards<br>
<br>
Thomas Baumgart<br>
<br>
<a href="https://www.signal.org/" rel="noreferrer" \
                target="_blank">https://www.signal.org/</a>           Signal, the \
                better WhatsApp<br>
-------------------------------------------------------------<br>
&#39;Knowing a computer language is neither a necessary nor a sufficient<br>
condition to know how to construct a computer program&#39; -- J.R. Tyrer<br>
-------------------------------------------------------------<br>
</blockquote></div>



[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic