G
Guest
I have a program which dispatches a time-consuming process to a new thread,
which sends an event when it is done (I have a custom eventargs class to
store the result). The eventargs contains an array of Bitmaps. If I post
the event with only one Bitmap in the array, it works fine. Otherwise, I get
a nullreference in the Invoke inside the form's event handler.
Inside mainform:
delegate void RadarDownloadCompleteEventHandler(object sender,
ImageDownloadCompleteEventArgs e);
void RadarHandler(object sender, ImageDownloadCompleteEventArgs e) {
if(InvokeRequired) {
Invoke(new RadarDownloadCompleteEventHandler(RadarHandler), new object[]
{sender, e});
return;
}
etc
}
If e's array contains 1 image, it works. More than that, and I get a
nullreference (though the debugger shows nothing is null).
Bug?
which sends an event when it is done (I have a custom eventargs class to
store the result). The eventargs contains an array of Bitmaps. If I post
the event with only one Bitmap in the array, it works fine. Otherwise, I get
a nullreference in the Invoke inside the form's event handler.
Inside mainform:
delegate void RadarDownloadCompleteEventHandler(object sender,
ImageDownloadCompleteEventArgs e);
void RadarHandler(object sender, ImageDownloadCompleteEventArgs e) {
if(InvokeRequired) {
Invoke(new RadarDownloadCompleteEventHandler(RadarHandler), new object[]
{sender, e});
return;
}
etc
}
If e's array contains 1 image, it works. More than that, and I get a
nullreference (though the debugger shows nothing is null).
Bug?