Skip to content

Commit 499110f

Browse files
More pointers that are NULL if the cell they point to ceases to exist
1 parent a8350f9 commit 499110f

File tree

3 files changed

+12
-11
lines changed

3 files changed

+12
-11
lines changed

src/MaximaManual.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ class MaximaManual
119119
jthread m_helpfileanchorsThread;
120120
std::mutex m_helpFileAnchorsLock;
121121
//! The configuration storage
122-
Configuration *m_configuration;
122+
Configuration *m_configuration = NULL;
123123
//! All anchors for keywords maxima's helpfile contains (singlepage version)
124124

125125
HelpFileAnchors m_helpFileURLs_singlePage;

src/Worksheet.cpp

+4-3
Original file line numberDiff line numberDiff line change
@@ -946,7 +946,7 @@ bool Worksheet::RecalculateIfNeeded(bool timeout) {
946946
wxStopWatch stopwatch;
947947
bool recalculated = false;
948948
bool stopwatchStarted = false;
949-
for (auto &cell : OnList(m_recalculateStart)) {
949+
for (auto &cell : OnList(m_recalculateStart.get())) {
950950
recalculated |= cell.Recalculate();
951951
if((cell.GetRect().GetTop() > m_configuration->GetVisibleRegion().GetBottom()) &&
952952
recalculated)
@@ -969,7 +969,7 @@ bool Worksheet::RecalculateIfNeeded(bool timeout) {
969969
}
970970
else
971971
{
972-
for (auto &cell : OnList(m_recalculateStart)) {
972+
for (auto &cell : OnList(m_recalculateStart.get())) {
973973
m_adjustWorksheetSizeNeeded |= cell.Recalculate();
974974
if(cell.GetNext() == NULL)
975975
{
@@ -6097,7 +6097,8 @@ void Worksheet::AddSelectionToEvaluationQueue(GroupCell *start,
60976097

60986098
void Worksheet::AddDocumentTillHereToEvaluationQueue() {
60996099
FollowEvaluation(true);
6100-
const GroupCell *stop = m_hCaretActive ? m_hCaretPosition : nullptr;
6100+
const GroupCell *stop = m_hCaretPosition.get();
6101+
if(!m_hCaretActive) stop = nullptr;
61016102
if (!stop) {
61026103
if (!GetActiveCell())
61036104
return;

src/Worksheet.h

+7-7
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ class Worksheet : public wxScrolled<wxWindow>
133133
*/
134134
wxClientDC m_dc;
135135
//! Where do we need to start the repainting of the worksheet?
136-
GroupCell *m_redrawStart = NULL;
136+
CellPtr<GroupCell> m_redrawStart;
137137
//! Do we need to redraw the worksheet?
138138
bool m_fullRedrawRequested = false;
139139
//! The clipboard format "mathML"
@@ -330,7 +330,7 @@ class Worksheet : public wxScrolled<wxWindow>
330330
331331
This pointer is needed for keeping track of cell contents changes.
332332
*/
333-
GroupCell *TreeUndo_ActiveCell;
333+
CellPtr<GroupCell> TreeUndo_ActiveCell;
334334

335335
//! Drop actions from the back of the undo list until itis within the undo limit.
336336
void TreeUndo_LimitUndoBuffer();
@@ -585,19 +585,19 @@ class Worksheet : public wxScrolled<wxWindow>
585585
See EditorCell::GetActiveCell() for the position if the cursor that is drawn as a
586586
vertical line.
587587
*/
588-
GroupCell *m_hCaretPosition = NULL;
588+
CellPtr<GroupCell> m_hCaretPosition;
589589
/*! The start for the selection when selecting group with the horizontally drawn cursor
590590
591591
This cell does define were the selection was actually started and therefore does not need
592592
to be above m_hCaretPositionEnd in the worksheet. See also m_cellPointers.m_selectionStart.
593593
*/
594-
GroupCell *m_hCaretPositionStart = NULL;
594+
CellPtr<GroupCell> m_hCaretPositionStart;
595595
/*! The end of the selection when selecting group with the horizontally drawn cursor
596596
597597
This cell does define where the selection was actually ended and therefore does not need
598598
to be below m_hCaretPositionEnd in the worksheet. See also m_cellPointers.m_selectionEnd.
599599
*/
600-
GroupCell *m_hCaretPositionEnd = NULL;
600+
CellPtr<GroupCell> m_hCaretPositionEnd;
601601
bool m_leftDown = false;
602602
//! Do we want to automatically scroll to a cell as soon as it is being evaluated?
603603
bool m_followEvaluation = true;
@@ -612,7 +612,7 @@ class Worksheet : public wxScrolled<wxWindow>
612612
//! Returns a pointer to the last cell of this worksheet
613613
GroupCell *GetLastCellInWorksheet() const;
614614
int m_clickType = CLICK_TYPE_NONE;
615-
GroupCell *m_clickInGC = NULL;
615+
CellPtr<GroupCell> m_clickInGC;
616616
//! true = blink the cursor
617617
bool m_blinkDisplayCaret = true;
618618
//! Is the blinking vertically-drawn cursor currently visible?
@@ -1609,7 +1609,7 @@ class Worksheet : public wxScrolled<wxWindow>
16091609
#endif
16101610
void UpdateConfigurationClientSize();
16111611
//! Where to start recalculation. NULL = No recalculation needed.
1612-
GroupCell *m_recalculateStart = NULL;
1612+
CellPtr<GroupCell> m_recalculateStart;
16131613
//! The x position of the mouse pointer
16141614
int m_pointer_x = -1;
16151615
//! The y position of the mouse pointer

0 commit comments

Comments
 (0)