Skip to content

Commit

Permalink
Fixed issue of bad array index being sent to a filter status array wh…
Browse files Browse the repository at this point in the history
…en DoUsfmFilterChanges() is called at the end of the project page of the wizard and no document is yet open.
  • Loading branch information
pngbill committed Jun 7, 2024
1 parent a077792 commit e7d508f
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 7 deletions.
25 changes: 25 additions & 0 deletions source/Adapt_It.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35345,6 +35345,7 @@ enum Reparse reparseDoc)
countBeforeEdit = countBeforeEdit; // avoid warning
countAfterEdit = countAfterEdit; // avoid warning

/*
// whm 29Feb204 added. We need to determine the filter status of the \x and \xt markers
// before the edit in the filter page, so we can use this information to adjust the
// filter status of the \xt marker properly after the filtering changes have been done
Expand All @@ -35360,6 +35361,7 @@ enum Reparse reparseDoc)
m_bMkr_xt_WasUnfilteredBeforeFilteringChange = !m_bMkr_xt_WasFilteredBeforeFilteringChange;
//m_bMkr_x_WasFilteredBeforeFilteringChange = (bool)pUsfmFilterPageCommon->m_filterFlagsDocBeforeEdit.Item(indexOfXmarker);
//m_bMkr_x_WasUnfilteredBeforeFilteringChange = !m_bMkr_x_WasFilteredBeforeFilteringChange;
*/

int numFlags = (int)pUsfmFilterPageCommon->m_filterFlagsDoc.GetCount();
// The usfm filter page's m_SfmMarkerAndDescriptionsDoc wxStringArray and the parallel
Expand Down Expand Up @@ -35436,6 +35438,29 @@ enum Reparse reparseDoc)

if (bFilterChangeInDoc)
{
// whm 7Jun2024 made the following booleans local to this block.
// These are designed to track the filter status of the \xt marker
// as it existed before a filtering session change using the filter
// page in Preferences.
bool m_bMkr_xt_WasFilteredBeforeFilteringChange;
bool m_bMkr_xt_WasUnfilteredBeforeFilteringChange;

// whm 29Feb204 added. We need to determine the filter status of the \x and \xt markers
// before the edit in the filter page, so we can use this information to adjust the
// filter status of the \xt marker properly after the filtering changes have been done
// by the TokenizeText() call below.
wxString xMkr = _T("\\x ");
wxString xtMkr = _T("\\xt ");
int indexOfXTmarker;
//int indexOfXmarker;
indexOfXTmarker = FindArrayStringUsingSubString(xtMkr, pUsfmFilterPageCommon->pSfmMarkerAndDescriptionsDoc, 0);
//indexOfXmarker = FindArrayStringUsingSubString(xMkr, pUsfmFilterPageCommon->pSfmMarkerAndDescriptionsDoc, 0);
//wxUnusedVar(indexOfXmarker);
m_bMkr_xt_WasFilteredBeforeFilteringChange = (bool)pUsfmFilterPageCommon->m_filterFlagsDocBeforeEdit.Item(indexOfXTmarker);
m_bMkr_xt_WasUnfilteredBeforeFilteringChange = !m_bMkr_xt_WasFilteredBeforeFilteringChange;
//m_bMkr_x_WasFilteredBeforeFilteringChange = (bool)pUsfmFilterPageCommon->m_filterFlagsDocBeforeEdit.Item(indexOfXmarker);
//m_bMkr_x_WasUnfilteredBeforeFilteringChange = !m_bMkr_x_WasFilteredBeforeFilteringChange;

// Any filter change in the Doc requires updating the current USFM and Filtering data
// structures.

Expand Down
7 changes: 0 additions & 7 deletions source/Adapt_It.h
Original file line number Diff line number Diff line change
Expand Up @@ -5036,13 +5036,6 @@ class CAdapt_ItApp : public wxApp
// whm 26Feb2024 the following m_bUnfiltering_ex_NotFiltered is set FALSE, but never used in code, so is now removed
//bool m_bUnfiltering_ex_NotFiltered; //BEW 18Apr20, TRUE when unfiltered filtered \ex ... \ex*

// whm 29Feb2024 added the following booleans to track the status of the \x and \xt marker before
// a filtering session using the filter page in Preferences.
//bool m_bMkr_x_WasFilteredBeforeFilteringChange;
bool m_bMkr_xt_WasFilteredBeforeFilteringChange;
//bool m_bMkr_x_WasUnfilteredBeforeFilteringChange;
bool m_bMkr_xt_WasUnfilteredBeforeFilteringChange;

wxString m_chapterVerseAttrSpan; // BEW 18Apr20, store nearest earlier ch:vs ref for error message

// whm 22Feb2024 moved the following two here to the App from the Doc, and renaming them m_...
Expand Down

0 comments on commit e7d508f

Please sign in to comment.