Welcome to the SRP Forum! Please refer to the SRP Forum FAQ post if you have any questions regarding how the forum works.

End_Dialog in event crashes OI

We are experiencing crashes of Open Insight when we try to close a window in an event. We have this both with SRP Edit Table and Report Table.

We are trying to simulate a popup window with a normal window, because a popup window cannot not be as sophisticated as a normal window. So in one window, we open another window with Dialog_Box. Then in the OnItemDblClick event we read the values of that row, and close the window with End_Dialog(@Window, returnValue). This crashes Open Insight.

I tried using Sent_Event(@Window, 'CLOSE') instead, but this didn't help. We also tried Post_Event(@Window, 'CLOSE'). This doesn't crash Open Insight, but most of the time this event doesn't come through at all.

Does anybody else have this behavior? Any suggestions would be welcome. Thanks!


  • What exactly is happening when OpenInsight crashes? Is this a runtime error or Windows level crash?
  • It's a windows level crash. Sometimes immediately, sometimes after a couple of double clicks.

    Our guess is that the window is being killed before all events are processed or closed properly. But we have no idea how to further investigate this.
  • Post_Event() is definitely the right solution. OI does not handle OLE events well in this scenario for the reasons you surmised. Usually, however, this results in a freed common error rather than a Windows level crash.

    How are you qualifying the OLE event? Synchronous or asynchronous? It needs to be the latter since modal forms in OI interfere with the event queue.
  • edited March 2017
    Thank you for your suggestion Don. We changed the qualifier for the Report Table to asynchronous and now it seems to work perfectly. I don't even have to use the Post_Event. I just use the End_Dialog in the event handling.
  • I'm curious to hear if this holds true consistently.
    Some time ago I developed a habit of a work around for dialog boxes for this very reason.
    I place an invisible OI button on the form. The OI button has a click event that triggers the close.
    When the OLE close button is clicked I send a post_event click to the OI button.
    A post_event(@Window, "CLOSE") wasn't sufficient to prevent the crash but the button click which in turn called the close seemed to do it.

    Now I use to qualify my events synchronously but I changed that to asynchronous in 2014. I'm pretty sure the problem persisted after that hence I never changed the work around. In fact I think the only reason I remember the work around half the time is because I create a window without the OI button, it crashes and I go "Oh that's right".

    That said, I don't think it crashes every time so that's why I'm listening for further updates. The removal of the synchronicity may have alleviated the frequency but not completely resolved the issue?

    I hope I'm wrong because I'd rather just place the OLE button on the form and be done with it.
  • Perhaps this isn't your issue, Mark, but using script event handlers will also make a difference. In this case, returning a 0 should also be done to prevent the event chain from continuing.
  • In a way it's comforting to see that we're not the only one with these issues :-). My colleague actually also suggested the way you are using Mark.

    I'm not sure whether the problem is completely solved now, or it just crashes after 20 times double clicking instead of 4. We did see that most Post_Events don't come through at all, so this wasn't really an option either. If the problem persists I will probably get back and report here.
Sign In or Register to comment.