Skip to content

AddData error due to that the line(layer) is not added to the plot #71

@asmwarrior

Description

@asmwarrior
/** Add data to the internal vector. This method DOES NOT refresh the mpWindow unless updatePlot = true;
 * Do it manually by calling UpdateAll() or just Fit() if we want to adjust plot
 * BEWARE : You can not call this function if mpFXYVector layer is not added to the mpWindow layers list.
 */
bool mpFXYVector::AddData(const double x, const double y, bool updatePlot)
{
  bool new_limit = false;
  const mpFloatRect* bbox = m_win->GetBoundingBox();

It will crash here, because the m_win is 0x0.

So that this code crashed:

            mpFXYVector* arrowLine = new mpFXYVector("Arrow");

            arrowLine->SetPen(wxPen(*wxBLACK, 2));

            arrowLine->AddData(plotStartX, plotStartY, false);
            arrowLine->AddData(plotEndX, plotEndY, false);

            plotWindow->AddLayer(arrowLine, true);
            plotWindow->Refresh();

Maybe, we have to add some error report or error check here inside the AddData()? function call.
Any ideas?
Thanks.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions