我有以下代码:
public class BufferedChart
{
...
private static LineClass m_lineDrawingAlgorithm = new LineClass();
...
public BitmapData LockBitmap()
{
...
unsafe
{
// Clear bitmap data (clear bitmap)
m_lineDrawingAlgorithm.ClearBitmapData(ref (*((int*)bmData.Scan0.ToPointer())), m_bufferBitmap.Width * m_bufferBitmap.Height);
m_cleared = true;
}
...
}
}
在访问lineDrawingAlgorithm时,它失败并出现NullReferenceException。它不是100%可重复的,但仍然可以将此引用置为空?它与unsafe
块有关还是以某种方式与LineClass是COM对象有关?