Hi Marc,
By "view" I meant the document window you type into. So if you choose
"new window" in the "Documents" menu item you get a new view. Every
fl_BlockLayout fl_SectionLayout etc. has a pointer held in the
fp_FragStrux vector of fmt handles.
The code calls these when the document content contained in
fp_FragStrux is changed. The fl_* classes then update themselves to
reflect these changes.
Cheers
Martin
On Sun, Jul 17, 2011 at 11:22 PM, J.M. Maurer <uwog@uwog.net> wrote:
> On Sun, 2011-07-17 at 22:30 +1000, Martin Sevior wrote:
>> Hi Volodymyr,
>>
>> The number of fmt handles in the strux's should match the number of
>> views on the document.
>
> Hmm, not all views store fmt handles in the strux's. AbiCollab for
> example is a listener, but it does not add any fmt handles.
>
> What did I confuse?
>
> Cheers!
> Marc
>
>
>> If it doesn't it is a sign that something is
>> going wrong. Rather than covering up these bugs with your patch I
>> think it far better to work out what is going wrong in the HTML
>> exporter.
>>
>> Since you have a document that reproducibly provides theses asserts,
>> it is a great chance to track down the cause of the bug.
>>
>> First we need to determine if the number of format handles is in error
>> from the import or the export. I suggest your write some test code in
>> pd_Document that scans the document and prints out the number of fmt
>> handles in each strux.
>>
>> You can simply start at the first frag, call getNext() on it until you
>> hit the end of the document. Every time your frag is of Strux type
>> examine number of fmtHandles in the strux.
>>
>> You should get one in every strux for each view you open.
>>
>> If the code passes that test see if you can trap when things goes
>> wrong during export. Try calling the test code at various places of
>> the export process to isolate where things go wrong. When you do, fix
>> the bug (or report what is wrong here if you can't:-)
>>
>> Cheers
>>
>> Martin
>>
>> On Sat, Jul 16, 2011 at 8:57 PM, Volodymyr Rudyj
>> <vladimir.rudoy@gmail.com> wrote:
>> >
>> > Good day !
>> >
>> > I need help and little code review. I`m working on improving HTML
>> > exporter (as you know, I`m using it in EPUB plugin). And while
>> > exporting some of the documents to HTML (and as a result to EPUB),
>> > e.g. abiword build instructions, assertion occurs which says that we
>> > tried to access element of the UT_vector by index which is out of
>> > range. I`ve found out that the reason is pf_Frag_Strux::getFmtHandle
>> > method. You can see stack trace at http://pastebin.com/nc6LSPe8 . So
>> > here is a little patch that fixes the problem. So what do you think
>> > about this patch?
>> >
>> > Thanks!
>> >
>> > ### Eclipse Workspace Patch 1.0
>> > #P abiword
>> > Index: src/text/ptbl/xp/pf_Frag_Strux.cpp
>> > ===================================================================
>> > --- src/text/ptbl/xp/pf_Frag_Strux.cpp (revision 30045)
>> > +++ src/text/ptbl/xp/pf_Frag_Strux.cpp (working copy)
>> > @@ -55,7 +55,7 @@
>> >
>> > PL_StruxFmtHandle pf_Frag_Strux::getFmtHandle(PL_ListenerId lid) const
>> > {
>> > - if (m_vecFmtHandle.size() == 0) return 0;
>> > + if ((m_vecFmtHandle.size() == 0) || (lid >= m_vecFmtHandle.size())) return 0;
>> > return (PL_StruxFmtHandle)m_vecFmtHandle.getNthItem(lid);
>> > }
>> >
>
>
>
Received on Sun Jul 17 23:55:27 2011
This archive was generated by hypermail 2.1.8 : Sun Jul 17 2011 - 23:55:27 CEST