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

Crash on Find and Replace

I'm getting SRP Editor (v2.5.6) eventually crashing on successive Find and Replace.

For example, Open the OIPI_EXAMPLE1 Stored Procedure and use Ctrl+H to Find 'Set_Printer' and Replace with 'Set_Print' (say). For me, this always happens happens after the 22nd replace. I get this on both XP and Windows 7.

It always seems to crash in the same place:
AppName: oinsight.exe AppVer: 8.0.8.0 ModName: srpeditor.ocx ModVer: 3.0.2.0 Offset: 00084ec8
Cheers, M@

Comments

  • Matt,

    Can you confirm the version of the SRPEditor.ocx? Also, are you using the "Replace All" or "Replace" feature? I have tried both in v2.5.6 of the SRP Editor (Win 7, OI v9.3.1) and I cannot get it to crash.
  • Hi Don,

    Yes - SRPEditor.ocx v3.0.2, OI v8.0.8. I use just "Replace" to confirm each occurrence. There is no crash if I "Replace All", and this succeeds for all 92 occurrences (in this example)

    I've tried reinstalling SRP Editor, with SRPcontrols.ocx only (ie. SRP_ActiveX_info shows SRPcontrols evaluation for all controls). In this case, the crash occurs at the same place with this:
    AppName: oinsight.exe AppVer: 8.0.8.0 ModName: srpcontrols.ocx ModVer: 3.0.6.0 Offset: 00121eae
    I've tried installing on a fresh OI 8.0.8, and also on OI 9.3.2 beta (which just hangs instead of crashing).

    Still happens on different XP and Windows 7 machines.

    A curly one! Any more info I can provide?
    Cheers, M@
  • Matt,

    Can you send me your OIPI_EXAMPLE1 routine? I want to eliminate as many differences as possible between our environments.
  • Here's the OIPI Example code, as in our OI 8.0.8
    subroutine OIPI_Example1(dummy) /* OIPI_Example1 This is an example program on how to use the OpenInsight Printer Interface. This example uses most of the features of the OpenInsight Printer Interface, and is a good place to start learning how to create reports with the OIPI. */ declare function Set_Printer, Get_Printer, RGB,Set_Property declare function msg $insert OIPRINT_EQUATES $Insert Ps_oipi_common $Insert RTI_Postscript_Common Equ Portrait$ To 0 Equ Landscape$ To 1 * print Setup Equate Equ Print_Style$ To 1 Equ Print_Zoom$ To 2 Equ Print_ToPrinter$ To 0 Equ Display_PrintSetup$ To 1 Equ Preview_Normal$ To 2 Equ Print_Mazimized$ To 3 Equ Display_AllButtons$ To 0 Equ Hide_PrintButton$ To 1 Equ Hide_PrintSetupButton$ To 2 Equ Hide_AllButtons$ To 3 * Create the fonts for the OIPI report * 18 point Arial font with left justified, bold and dark blue color Font1 = "Arial":@FM:18:@FM:"L":@FM:1:@FM:0:@FM:0:@FM:0:@FM:RGB(0, 0, 172) * 16 point Times New Roman with left justified bold, italics, underline, and dark magenta Font2 = "Times New Roman":@FM:16:@FM:"L":@FM:1:@FM:1:@FM:1:@FM:0:@FM:RGB(192, 0, 172) * 14 point Times New Roman with left justified Font3 = "Times New Roman":@FM:14 * Start the OIPI report with the INIT message FileName = "OIPI_Example1" PrintTitle = "OIPI Printing..." PreviewTitle = "OIPI Print Preview" Margins = .5:@FM:1:@FM:.5:@FM:1 ;* half inch margins On the sides, one inch margins On the top Orientation = Portrait$ PrintSetup = "" PrintSetup<Print_Style$, 1> = Preview_normal$ PrintSetup<Print_Style$, 2> = Display_AllButtons$ PrintSetup<2> = -1 ;* Set initial zoom to PageWidth PrintSetup<3> = 5 ;* Set the Print Preview position at 5% from top and left PrintSetup<4> = 5 PrintSetup<5> = 95 PrintSetup<6> = 95 VAL = Set_Printer("INIT", FileName, PrintTitle:@FM:PreviewTitle, Margins, Orientation, PrintSetup) if VAL < 0 then * Always check the return value of the INIT message for error ErrorMsg = "Fatal error with the INIT message:":VAL goto fatalExit end * Set the font for all of the headers and footers if Set_Printer("FONTHEADFOOT", "Arial":@FM:14:@FM:"L":1) < 0 then ErrorMsg = "Error with the FONTHEADFOOT message" goto fatalExit end * Print the header with the file name centered on the first line and * the Long format of the date left justified and the page number right justified * on the second line. x = Set_Printer("HEADER", @VM:"'F'":@FM:"'DL'":@VM:@VM:"Page 'P'":@FM) *x = Set_Printer("HEADER", "The Header Text") If x < 0 then ErrorMsg = "Error with the HEADER message" goto fatalExit end if Set_Printer("FONT", Font1) < 0 then ErrorMsg = "Error with the FONT message" goto fatalExit End if Set_Printer("TEXT", "Welcome to the OpenInsight Printer Interface!!!") < 0 then * I'm not going to check the remaining TEXT messages, because if the first one * works then the remaining TEXT messages should also work. ErrorMsg = "Error with the TEXT message" goto fatalExit end Stat = Set_Printer('CALCTEXT',@Upper.Case) AA = Get_Printer('CALCTEXT') if Set_Printer("FONT", Font2) < 0 then ErrorMsg = "Error with the FONT message" goto fatalExit end x = Set_Printer("TEXT", @FM:"Introduction") if Set_Printer("FONT", Font3) < 0 then ErrorMsg = "Error with the FONT message" goto fatalExit end text = "This program will demonstrate the basic features of the OpenInsight Printer Interface. There are several new features in the OIPI 3.x, so please check the online help file for the latest message formats." x = Set_Printer("TEXT", text) if Set_Printer("FONT", Font2) < 0 then ErrorMsg = "Error with the FONT message" goto fatalExit end x = Set_Printer("TEXT", @FM:"Get_Printer for VERSION and SERIAL") if Set_Printer("FONT", Font3) < 0 then ErrorMsg = "Error with the FONT message" goto fatalExit end ver = Get_Printer("VERSION") text = "You are currently using version '":ver<1>:"' of the OIPI, and the OIPI build number is '":ver<2>:"' and the VSVIEW control version is '":ver<3>:"'":@FM:"Your serial number is ":Get_Printer("SERIAL") x = Set_Printer("TEXT", text) if Set_Printer("FONT", Font2) < 0 then ErrorMsg = "Error with the FONT message" goto fatalExit end x = Set_Printer("TEXT", @FM:"BMP and TEXTXY") if Set_Printer("FONT", Font3) < 0 then ErrorMsg = "Error with the FONT message" goto fatalExit end text = "This will demostrate the use of graphic files and the TEXTXY message. The graphic file (BANNER.WMF) is printed first, " text := "then the text is printed over it with the TEXTXY message. The text shadow is created by offsetting two separate TEXTXY messages." text := "The current Y position is used to determine where to print the graphics and text using the Get_Printer POS message." text := "You can strectch the graphics with the BMP message.":@FM x = Set_Printer("TEXT", text) * Print the banner.wmf and text inside pos = Get_Printer("POS") if Set_Printer("BMP", "BANNER.WMF", 0:@FM:pos<2>:@FM:3.5:@FM:1, 1, 0) < 0 then ErrorMsg = "Error with the BMP message" goto fatalExit end if Set_Printer("TEXTXY", "Banner Text", .77:@FM:pos<2>+0.48, "Arial":@FM:24:@FM:"L":@FM:1:@FM:0:@FM:0:@FM:0:@FM:RGB(192, 192, 192):@FM:100, 0) < 0 then ErrorMsg = "Error with the TEXTXY message" goto fatalExit end if Set_Printer("TEXTXY", "Banner Text", .80:@FM:pos<2>+0.45, "Arial":@FM:24:@FM:"L":@FM:1:@FM:0:@FM:0:@FM:0:@FM:RGB(128, 0, 128):@FM:100, 0) < 0 then ErrorMsg = "Error with the TEXTXY message" goto fatalExit end if Set_Printer("BMP", "PRINTER.BMP", 4.0:@FM:pos<2>:@FM:1.6:@FM:1, 0, 0) < 0 then ErrorMsg = "Error with the BMP message" goto fatalExit end * Reset the text position below the graphics by adding one inch to the last position x = Set_Printer("POS", 0:@FM:pos<2> + 1) if Set_Printer("FONT", Font2) < 0 then ErrorMsg = "Error with the FONT message" goto fatalExit end x = Set_Printer("TEXT", @FM:"RECT, CALC_TEXT, POLYGON, and Colors") if Set_Printer("FONT", Font3) < 0 then ErrorMsg = "Error with the FONT message" goto fatalExit end text = "The next section demonstrates how to use colors with the RECT message, and how to use the CALC_TEXT message to calculate the height and width of text and place a box around the text. " text := "The POLYGON message is used to print the gray shading in the 3D button." x = Set_Printer("TEXT", text) * Print pyramid if Set_Printer("LINESTYLE", PS_NULL) < 0 then ErrorMsg = "Error with the LINESTYLE message" goto fatalExit end pos = Get_Printer("POS") y = pos<2> offset = 0 for c = 0 to 128 step 12.8 if Set_Printer("FILLSTYLE", BS_SOLID:@FM:RGB(0, 0, 128 + c)) < 0 then ErrorMsg = "Error with the FILLSTYLE message" goto fatalExit end R = 1+offset:@FM:y+offset:@FM:3-offset:@FM:y-offset+2 if Set_Printer("RECT", 1+offset:@FM:y+offset:@FM:3-offset:@FM:y-offset+2, 0) < 0 then ErrorMsg = "Error with the RECT message" goto fatalExit end offset = offset + 0.05 next c for c = 0 to 128 step 12.8 if Set_Printer("FILLSTYLE", BS_SOLID:@FM:RGB(c, c, 255)) < 0 then ErrorMsg = "Error with the FILLSTYLE message" goto fatalExit end if Set_Printer("RECT", 1+offset:@FM:pos<2>+offset:@FM:3-offset:@FM:pos<2>+2-offset, 0) < 0 then ErrorMsg = "Error with the RECT message" goto fatalExit end offset = offset + 0.05 next c if Set_Printer("LINESTYLE", PS_SOLID:@FM:1:@FM:RGB(0, 0, 0)) < 0 then ErrorMsg = "Error with the LINESTYLE message" goto fatalExit end if Set_Printer("FILLSTYLE", BS_HOLLOW) < 0 then ErrorMsg = "Error with the FILLSTYLE message" goto fatalExit end if Set_Printer("RECT", 1:@FM:pos<2>:@FM:3:@FM:pos<2>+2, 0) < 0 then ErrorMsg = "Error with the RECT message" goto fatalExit end if Set_Printer("LINE", 1:@FM:pos<2>:@FM:3:@FM:pos<2>+2, 0) < 0 then ErrorMsg = "Error with the LINE message" goto fatalExit end if Set_Printer("LINE", 3:@FM:pos<2>:@FM:1:@FM:pos<2>+2, 0) < 0 then ErrorMsg = "Error with the LINE message" goto fatalExit end * print 3D button text = "3D Button" if Set_Printer("FILLSTYLE", BS_SOLID:@FM:RGB(128, 128, 128)) < 0 then ErrorMsg = "Error with the FILLSTYLE message" goto fatalExit end if Set_Printer("FONT", "Arial":@FM:14) < 0 then ErrorMsg = "Error with the FONT message" goto fatalExit end if Set_Printer("CALCTEXT", text) < 0 then ErrorMsg = "Error with the CALCTEXT message" goto fatalExit end size = Get_Printer("CALCTEXT") width = size<1> height = size<2> poly = "" poly<1> = 3.5+width+.4:@VM:y poly<2> = 3.5+width+.4:@VM:y+height+.4 poly<3> = 3.5:@VM:y+height+.4 poly<4> = 3.5+.1:@VM:y+height+.3 poly<5> = 3.5+width+.3:@VM:y+height+.3 poly<6> = 3.5+width+.3:@VM:y+.1 if Set_Printer("POLYGON", poly, 0) < 0 then goto fatalExit end xxx = get_printer("font") if Set_Printer("FILLSTYLE", BS_HOLLOW) < 0 then ErrorMsg = "Error with the FILLSTYLE message" goto fatalExit end xxx = get_printer("font") if Set_Printer("RECT", 3.5:@FM:y:@FM:3.5+width+.4:@FM:y+height+.4, 0) < 0 then ErrorMsg = "Error with the RECT message" goto fatalExit end xxx = get_printer("font") if Set_Printer("FILLSTYLE", BS_SOLID:@FM:RGB(192, 192, 192)) < 0 then ErrorMsg = "Error with the FILLSTYLE message" goto fatalExit end if Set_Printer("RECT", 3.5+.1:@FM:y+.1:@FM:3.5+width+.3:@FM:y+height+.3, 0) < 0 then ErrorMsg = "Error with the RECT message" goto fatalExit end xxx = get_printer("font") if Set_Printer("TEXTXY", text, 3.7:@FM:y+.2, "", 0) < 0 then ErrorMsg = "Error with the TEXTXY message" goto fatalExit end if Set_Printer("FONT", "Times New Roman":@FM:12) < 0 then ErrorMsg = "Error with the FONT message" goto fatalExit end * Force a page break if Set_Printer("PAGEBREAK") < 0 then ErrorMsg = "Error with the PAGEBREAK message" goto fatalExit end if Set_Printer("FONT", Font2) < 0 then ErrorMsg = "Error with the FONT message" goto fatalExit end x = Set_Printer("TEXT", "POLYLINE, ADDTABLE, and TEXTXY") if Set_Printer("FONT", Font3) < 0 then ErrorMsg = "Error with the FONT message" goto fatalExit end text = "The POLYLINE message is used to create this Graph, and the ADDTABLE message is used to create the Table. The TEXTXY message is used to print the labels." x = Set_Printer("TEXT", text) pos = Get_Printer("POS") y = pos<2>+.25 if Set_Printer("FILLSTYLE", BS_SOLID:@FM:RGB(255, 255, 128)) < 0 then ErrorMsg = "Error with the FILLSTYLE message" goto fatalExit end ErrorMsg = "There was some problem with the Graph part of the example" if Set_Printer("RECT", 3:@FM:y:@FM:6:@FM:y+2, 0) < 0 then goto fatalExit if Set_Printer("RECT", 1:@FM:y:@FM:2.5:@FM:y+0.5, 0) < 0 then goto fatalExit if Set_Printer("LINESTYLE", PS_DOT:@FM:0:@FM:RGB(0, 0, 0)) < 0 then goto fatalExit if Set_Printer("LINE", 3:@FM:y+.5:@FM:6:@FM:y+.5, 0) < 0 then goto fatalExit if Set_Printer("LINE", 3:@FM:y+1:@FM:6:@FM:y+1, 0) < 0 then goto fatalExit if Set_Printer("LINE", 3:@FM:y+1.5:@FM:6:@FM:y+1.5, 0) < 0 then goto fatalExit initrnd timedate() poly1 = "" for i = 0 to 12 sx = i/4 sy = y+1-rnd(100)/100 poly1<i+1,1> = sx + 3 poly1<i+1,2> = sy next i if Set_Printer("LINESTYLE", PS_SOLID:@FM:1:@FM:RGB(0, 128, 0)) < 0 then goto fatalExit if Set_Printer("POLYLINE", poly1, 0) < 0 then goto fatalExit if Set_Printer("LINE", 1.2:@FM:y+0.15:@FM:1.5:@FM:y+0.15, 0) < 0 then goto fatalExit poly2 = "" for i = 0 to 12 sx = i/4 sy = y+1-rnd(100)/100 poly2<i+1,1> = sx + 3 poly2<i+1,2> = sy next i if Set_Printer("LINESTYLE", PS_SOLID:@FM:1:@FM:RGB(128, 0, 0)) < 0 then goto fatalExit if Set_Printer("POLYLINE", poly2, 0) < 0 then goto fatalExit if Set_Printer("LINE", 1.2:@FM:y+0.35:@FM:1.5:@FM:y+0.35, 0) < 0 then goto fatalExit if Set_Printer("LINESTYLE", PS_SOLID:@FM:1:@FM:RGB(0, 0, 0)) < 0 then goto fatalExit if Set_Printer("FONT", "Arial":@FM:8) < 0 then goto fatalExit if Set_Printer("TEXTXY", "4.0", 2.8:@FM:y-.05, "", 0) < 0 then goto fatalExit if Set_Printer("TEXTXY", "3.0", 2.8:@FM:y+.45, "", 0) < 0 then goto fatalExit if Set_Printer("TEXTXY", "2.0", 2.8:@FM:y+.95, "", 0) < 0 then goto fatalExit if Set_Printer("TEXTXY", "1.0", 2.8:@FM:y+1.45, "", 0) < 0 then goto fatalExit if Set_Printer("TEXTXY", "0.0", 2.8:@FM:y+1.95, "", 0) < 0 then goto fatalExit if Set_Printer("TEXTXY", "Years", 4.4:@FM:y+2.05, "", 0) < 0 then goto fatalExit if Set_Printer("TEXTXY", "$Millions", 2.8:@FM:y-.2, "", 0) < 0 then goto fatalExit if Set_Printer("FONT", "Arial":@FM:10) < 0 then goto fatalExit if Set_Printer("TEXTXY", "XYZ Co.", 1.6:@FM:y+0.07, "", 0) < 0 then goto fatalExit if Set_Printer("TEXTXY", "ABC Co.", 1.6:@FM:y+0.27, "", 0) < 0 then goto fatalExit if Set_Printer("FILLSTYLE", BS_HOLLOW) < 0 then goto fatalExit if Set_Printer("RECT", 3:@FM:y:@FM:6:@FM:y+2, 0) < 0 then goto fatalExit ErrorMsg = "There was some problem with the ADDTABLE part of the example" if Set_Printer("POS", 0:@FM:y+1) < 0 then goto fatalExit header = "Year":@VM:"XYZ Co. Sales ($Mill)":@VM:"ABC Co. Sales ($Mill)":@FM table = "" for i = 0 to 12 table<i+1,1> = 1990+i table<i+1,2> = 3.5+y-poly1<i+1,2> table<i+1,3> = 3.5+y-poly2<i+1,2> next i if Set_Printer("FONT", "Arial":@FM:10:@FM:"L":@FM:1) < 0 then goto fatalExit ColumnFormat = "_^770":@VM:"_>1080":@VM:"_>1080":@FM if Set_Printer("ADDTABLE", ColumnFormat, header, table, RGB(0, 222, 0), "", "", TB_BOX_COLUMNS) < 0 then goto fatalExit if Set_Printer("CALCTABLE", ColumnFormat:header:table) < 0 then goto fatalExit size = Get_Printer("CALCTABLE") if Set_Printer("POS", 0:@FM:y+1+size<2>) < 0 then goto fatalExit if Set_Printer("FONT", Font2) < 0 then ErrorMsg = "Error with the FONT message" goto fatalExit end x = Set_Printer("TEXT", @FM:"Other New Features in the OIPI") if Set_Printer("FONT", Font3) < 0 then ErrorMsg = "Error with the FONT message" goto fatalExit end text = " * The OIPI 3.5 uses the newest VSVIEW.OCX control for the print engine.":@FM text := " * The OIPI 3.2 was rewritten in Microsoft Visual Basic 4.0.":@FM text := " * The ADDTABLE message was added to improve the quality of tables. This message should be used to replace all TABLE and TEXTCOL messages.":@FM text := " * The Print Preview window can be scrolled with the mouse and all pages are viewable as soon as they are printed.":@FM text := " * The IMIT message can be used to change the size of the paper without using the Printer Setup dialog box.":@FM text := " * The CALCBMP and CALCTABLE messages were added.":@FM text := " * The title of the Print Preview window can be customized.":@FM x = Set_Printer("TEXT", text) * End the report and tell the OIPI to completely shut down after the print preview is closed. x = Set_Printer("TERM", 1) return * jump here if any Set_Printer returns a value < 0 fatalExit: x = msg("", ErrorMsg) x = Set_Printer("TERM", 1) return
    Cheers, M@
  • Matt,

    Thanks for the posting of the code. I also received your attachment via email yesterday. I plugged it in but could not get the system to crash. I was waiting to test this on other machines before I replied back. I have had limited access to other machines but hopefully my colleagues on staff will help test this for me. Stay tuned....
  • Yeap - just though it would be good to keep things up here

    Some further findings:
    - The crash can happen immediately if selecting Format Code from the Tools menu
    - The crash does not occur if I first toggle the Edit mode to 'Text', then back to 'Code'
    - The crash seems due to lines 175 and 180 [Set_Printer("TEXTXY", "Banner Text", .77:@FM:pos<2>+0.48,...]. In particular, the '2' in the ".77:@FM:pos<2>+0.48" parameter (which displays in Red in 'Code' mode) . Inserting a space in front of the '2' (ie pos< 2>), avoids the crash.

    It appears to be related to the colorization of text for 'Code' Edit Mode? I don't believe I have overridden any of my 'Style' Editor Options settings.

    Hope this gives some further clues.
    Cheers, M@
  • Matt,

    Kevin and I have tried to replicate this but without success. Based on your second point it appears that you are opening this up as a record or DOS file rather than a stored procedure. We tried opening this in every way we can think of but nothing ever crashes, even the formatting tool works for us.

    Is it possible that the code you sent us was already cleaned up? I am curious if your code has some hidden character that might be causing a problem for the SRP Editor but in the transition from your system to us it has been stripped. Can you take the same file you sent me and load that in your system and duplicate the crash?

    Our only other option is to witness you in action just to see if we can observe something different. Let me know how you would like to proceed. You are welcome to video record your activity and send that to us as well.

    Thanks.
  • Hi Don,

    Yes, the above was done on the same txt file I emailed you. I get the same thing occurring regardless of whether the source is the txt file or the program in SYSPROCS.

    I'm quite happy to show you online if you like. Let me know the details on how/when to set that up. We have a GotoMeeting account that we can use if you prefer - let me know and I'll email you the details.

    Cheers, M@
  • Hi Guys,

    I've done a video that shows the crash happening under various scenarios. You can view it at screencast.com/t/wJ9tLIHVwGS

    Hope this can help. Let me know if I can provide any further info.
    Cheers, M@
  • Matt,

    The video was brilliant. I was finally able to get OI to crash on line 180 but I had to replace Set_Printer with SP. If I use Set_Print it still works fine. Now I just need to make sure my engineers can replicate the problem as well. We will keep you posted.

    Thanks for the effort!
  • I was able to recreate this as well. It crashes in a very obscure way, so it won't be easy to diagnose, but at least it's happening for me. I'll keep you posted.
  • Great! - I'm glad the video was useful. Curious our circumstances are slightly different. I wonder if some Windows localization is involved!?

    Cheers M@
  • Matt,

    I sent you an email with a beta copy of the SRPEditor.ocx. Please let me know if you do not get this.

    Thanks.
  • Hi Don,

    Thanks - this version of SRPEditor.ocx passes all crash scenarios that I'm aware of. Well done!

    Cheers, M@
Sign In or Register to comment.