http://bugs.winehq.org/show_bug.cgi?id=14827
Summary: Autocad 2005 : Multiline text edit crashes application Product: Wine Version: CVS/GIT Platform: PC-x86-64 OS/Version: Linux Status: UNCONFIRMED Severity: normal Priority: P2 Component: -unknown AssignedTo: wine-bugs@winehq.org ReportedBy: max@veneto.com
If you try to edit a multiline text (MTEXT) or a dimension text on autocad (tested on 2005), following happens :
1) The editor is (correctly) shown, but edited text is not visible on text area 2) If you use ESC to abort command, you retourns on autocad correctly 3) If you press OK button to accept changes, the whole autocad hangs.
Ciao
Max
http://bugs.winehq.org/show_bug.cgi?id=14827
--- Comment #1 from Lei Zhang thestig@google.com 2008-08-11 20:11:47 --- Can you attach the console output?
http://bugs.winehq.org/show_bug.cgi?id=14827
max@veneto.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |max@veneto.com
--- Comment #2 from max@veneto.com 2008-08-12 02:54:54 --- Here the relevant part, just after issuing command :
fixme:richedit:RichEditWndProc_common EM_SELECTIONTYPE: stub fixme:richedit:RichEditWndProc_common Unsupported yet non NULL device in EM_SETTARGETDEVICE fixme:richedit:RichEditWndProc_common Unsupported yet non NULL device in EM_SETTARGETDEVICE fixme:richedit:RichEditWndProc_common Unsupported yet non NULL device in EM_SETTARGETDEVICE fixme:richedit:RichEditWndProc_common EM_SELECTIONTYPE: stub fixme:richedit:RichEditWndProc_common Unsupported yet non NULL device in EM_SETTARGETDEVICE fixme:richedit:RichEditWndProc_common EM_SELECTIONTYPE: stub fixme:richedit:RichEditWndProc_common EM_SELECTIONTYPE: stub fixme:richedit:RichEditWndProc_common EM_SELECTIONTYPE: stub fixme:richedit:RichEditWndProc_common EM_SELECTIONTYPE: stub
The text edit box appears, but no text inside it. Here what happens after pressing OK button :
fixme:richedit:RichEditWndProc_common EM_SELECTIONTYPE: stub fixme:richedit:RichEditWndProc_common EM_SELECTIONTYPE: stub fixme:richedit:IRichEditOle_fnGetObjectCount stub 0xa3160c8 fixme:richedit:RichEditWndProc_common EM_SELECTIONTYPE: stub fixme:richedit:RichEditWndProc_common EM_SELECTIONTYPE: stub fixme:richedit:IRichEditOle_fnGetObjectCount stub 0xa316090 fixme:richedit:RichEditWndProc_common EM_SELECTIONTYPE: stub fixme:richedit:RichEditWndProc_common EM_SELECTIONTYPE: stub
Then autocad hangs here (no crash, just hang with 100% cpu usage). Only way to recover it is to kill the process.
Ciao
Max
http://bugs.winehq.org/show_bug.cgi?id=14827
--- Comment #3 from max@veneto.com 2008-11-04 17:01:47 --- Another test, easyly reproductible : enter autocad, issue MTEXT command, select a text area on screen, you can enter the text. If you press OK button to accept, the app hangs with 100% cpu; output is :
(ok button pressed)
fixme:richedit:RichEditWndProc_common EM_SELECTIONTYPE: stub fixme:richedit:RichEditWndProc_common EM_SELECTIONTYPE: stub fixme:richedit:IRichEditOle_fnGetObjectCount stub 0xa3264a8 fixme:richedit:RichEditWndProc_common EM_SELECTIONTYPE: stub fixme:richedit:RichEditWndProc_common EM_SELECTIONTYPE: stub fixme:richedit:IRichEditOle_fnGetObjectCount stub 0xa326470 fixme:richedit:ME_StreamOutFlush Invalid returned written size *pcb: 0x1e5 (485) instead of 460 fixme:richedit:RichEditWndProc_common EM_SELECTIONTYPE: stub fixme:richedit:RichEditWndProc_common EM_SELECTIONTYPE: stub
(program hangs here).
If you press ESC instead of OK (so canceling the text input) the app behaves normally.
Latest wine git of today.
Ciao
Max
http://bugs.winehq.org/show_bug.cgi?id=14827
ruelle deejaypelle@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |NEW Ever Confirmed|0 |1
--- Comment #4 from ruelle deejaypelle@gmail.com 2009-01-19 17:36:22 --- *** This bug has been confirmed by popular vote. ***
http://bugs.winehq.org/show_bug.cgi?id=14827
max@veneto.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Version|CVS/GIT |1.1.13
--- Comment #5 from max@veneto.com 2009-01-19 17:49:01 --- Present since before wine 1.0.
Ciao
Max
http://bugs.winehq.org/show_bug.cgi?id=14827
Dan Kegel dank@kegel.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |dank@kegel.com
--- Comment #6 from Dan Kegel dank@kegel.com 2009-01-19 18:40:52 --- Does 'wget http://kegel.com/wine/winetricks; sh winetricks riched20' work around the problem?
http://bugs.winehq.org/show_bug.cgi?id=14827
--- Comment #7 from max@veneto.com 2009-01-20 07:13:10 --- (In reply to comment #6)
Does 'wget http://kegel.com/wine/winetricks; sh winetricks riched20' work around the problem?
Nope, but it has a strange side-effect.... when I select OK after editing multiline text, it starts to load additional autocad modules (!!!) and then hangs as usual. It's like some bad message get sent to autocad. Btw, on console the only thing I get after pressing ok is
fixme:resource:GetGuiResources (0xffffffff,0): stub
(of course, with no special debug channel enabled).
Ciao
Max
http://bugs.winehq.org/show_bug.cgi?id=14827
Dmitry Timoshkov dmitry@codeweavers.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC|max@veneto.com | Version|1.1.13 |unspecified
--- Comment #8 from Dmitry Timoshkov dmitry@codeweavers.com 2009-01-20 10:46:14 --- (In reply to comment #5)
Present since before wine 1.0.
Then 1.1.13 is wrong number.
http://bugs.winehq.org/show_bug.cgi?id=14827
--- Comment #9 from max@veneto.com 2009-04-20 07:30:45 --- Just to summarize what I've found so far.... 1) The problem is NOT due to richedit20. Using window's one hangs the application about on the same way. 2) Putting some debugging message inside richedit20 code, I could see that the problem arises only when this message gets printed :
fixme:richedit:ME_StreamOutFlush Invalid returned written size *pcb: 0x1e5 (485) instead of 460
The numbers can of course change. The callback function reads some more bytes than asked ones and hangs somewhere. The strange stuff is that on windows it works, and the callback function is (presumably) inside autocad code.....
3) If I make the function ME_StreamOutPrint() a no-op, the app works, of course the rtf formatting is lost and is instead partially put inside the edited string. No hangs anymore.
I guess it could be an OLE problem somewhere, but not sure about. Autocad is NOT runnable with relay enabled nor it runs under debugger because of copy protection. I've still not found where exactly the application hangs, and wether is inside wine or autocad itself. If somebody could explain me how rtf editor is called by application via OLE I could maybe find some more.... This is one of the last 3 bugs that keeps autocad away from being be a platinum app, and the other 2 are non-blocking ones, so it would be nice to have it solved.
Ciao
Max
http://bugs.winehq.org/show_bug.cgi?id=14827
--- Comment #10 from max@veneto.com 2009-04-20 07:42:51 --- Created an attachment (id=20572) --> (http://bugs.winehq.org/attachment.cgi?id=20572) Some fake FIXME's added to riched's code - Shows where app hangs
For completness I add here a log got with +ole and some debug messages added to richedit code, just the last part, from editor invoking up to the crash.
Ciao
Max
http://bugs.winehq.org/show_bug.cgi?id=14827
--- Comment #11 from Dan Kegel dank@kegel.com 2009-04-20 07:44:56 --- Does 'winetricks dcom98' help? (It's risky, usually doesn't help these days, but worth a shot.) http://appdb.winehq.org/objectManager.php?sClass=version&iId=102&iTe... shows that autocad 2000 still benefits from dcom98.
http://bugs.winehq.org/show_bug.cgi?id=14827
--- Comment #12 from max@veneto.com 2009-04-20 07:48:26 --- (In reply to comment #11)
Does 'winetricks dcom98' help? (It's risky, usually doesn't help these days, but worth a shot.) http://appdb.winehq.org/objectManager.php?sClass=version&iId=102&iTe... shows that autocad 2000 still benefits from dcom98.
Hi Dan :-) I tested DCOM98 some time ago with autocad2005, it didn't work.... In my small experience, I've seen that it helps seldom, anyways. Do you know some way to locate the point in code where app hangs, without relay nor debugging possible ? That bug's driving me mad.
Ciao
Max
http://bugs.winehq.org/show_bug.cgi?id=14827
--- Comment #13 from Dan Kegel dank@kegel.com 2009-04-20 07:55:12 --- You're doing fine, what's missing is more understanding of COM arcana, I'm afraid.
Try the tip in http://appdb.winehq.org/objectManager.php?sClass=version&iId=5658 That app also had the "ME_StreamOutFlush Invalid returned written size" error, and somebody found a workaround, at least for that app: "Everything works, (!) but only if you install the packaged libraries, into windows/system/ of wine: COMCAT.DLL -> register with "wine regsvr32 PATH2DLL/COMCAT.DLL" OLEAUT32.DLL -> -"- OLEPRO32.DLL -> -"- STDOLE2.TLB -> no need to register Furthermore you have to activate these native libraries via winecfg. "
http://bugs.winehq.org/show_bug.cgi?id=14827
--- Comment #14 from max@veneto.com 2009-04-20 08:28:15 --- (In reply to comment #13)
You're doing fine, what's missing is more understanding of COM arcana, I'm afraid.
Try the tip in http://appdb.winehq.org/objectManager.php?sClass=version&iId=5658 That app also had the "ME_StreamOutFlush Invalid returned written size" error, and somebody found a workaround, at least for that app: "Everything works, (!) but only if you install the packaged libraries, into windows/system/ of wine: COMCAT.DLL -> register with "wine regsvr32 PATH2DLL/COMCAT.DLL" OLEAUT32.DLL -> -"- OLEPRO32.DLL -> -"- STDOLE2.TLB -> no need to register Furthermore you have to activate these native libraries via winecfg. "
Thanx for the link. I looked at it, but the behaviour is different.... This app don't set the *pcb field when returning from callback, leaving so the original value (0xDEADBEEF, nice default, indeed, even if 0xDEADC0DE would have been more appropriate :-) ). In autocad, the app DOES set it, but with a somehow bigger value than what requested.... So, I guess the callback do indeed read more bytes than necessary. The strange stuff is that the callback should be (I think....) inside autocad code.... Because of that I'd need to know where exactly the app hangs. Debugging OLE without knowing its internals would be a nightmare, I guess.
Ciao
Max
http://bugs.winehq.org/show_bug.cgi?id=14827
--- Comment #15 from max@veneto.com 2009-04-23 17:14:56 --- Created an attachment (id=20645) --> (http://bugs.winehq.org/attachment.cgi?id=20645) Workaround to MTEXT crash
Suppressing font table stream out inside dlls/riched20/writer.c makes AutoCAD happy with multiline text. Strange stuff..... I'll investigate a bit more. In the meanwhile, it works quite well as a workaround..... here the related hacky patch. Beware, it's just a workaround and I don't know if it'll work for you....
Ciao
Max
http://bugs.winehq.org/show_bug.cgi?id=14827
--- Comment #16 from Austin English austinenglish@gmail.com 2009-04-23 17:50:10 --- Please attach a +richedit trace.
http://bugs.winehq.org/show_bug.cgi?id=14827
Dylan Smith dylan.ah.smith@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |dylan.ah.smith@gmail.com
--- Comment #17 from Dylan Smith dylan.ah.smith@gmail.com 2009-04-23 20:55:04 --- (In reply to comment #9)
- Putting some debugging message inside richedit20 code, I could see that the
problem arises only when this message gets printed :
fixme:richedit:ME_StreamOutFlush Invalid returned written size *pcb: 0x1e5 (485) instead of 460
The numbers can of course change. The callback function reads some more bytes than asked ones and hangs somewhere.
I don't have AutoCAD 2005 to test, so I can will make a guess as to why the callback function may read more bytes than the amount written. The callback may be looking for a NULL byte to determine the amount of bytes written, instead of looking at the using the cb value.
Try making the following change to add the NULL byte that native richedit controls include, and see if the fixme message still gets printed for the *pcd value.
diff --git a/dlls/riched20/writer.c b/dlls/riched20/writer.c index d1d9990..17134b4 100644 --- a/dlls/riched20/writer.c +++ b/dlls/riched20/writer.c @@ -904,7 +904,7 @@ ME_StreamOutRTF(ME_TextEditor *editor, ME_OutStream *pStream, int nStart, int nC break; p = ME_FindItemFwd(p, diRunOrParagraphOrEnd); } - if (!ME_StreamOutPrint(pStream, "}")) + if (!ME_StreamOutPrint(pStream, "}\0")) return FALSE; return TRUE; }
http://bugs.winehq.org/show_bug.cgi?id=14827
--- Comment #18 from Dylan Smith dylan.ah.smith@gmail.com 2009-04-23 21:06:03 --- Sorry, the previous patch didn't end up doing what I was trying to do, since I needed the length of the string to be specified. Try the following instead.
diff --git a/dlls/riched20/writer.c b/dlls/riched20/writer.c index d1d9990..b6c3ed6 100644 --- a/dlls/riched20/writer.c +++ b/dlls/riched20/writer.c @@ -904,7 +904,7 @@ ME_StreamOutRTF(ME_TextEditor *editor, ME_OutStream *pStream break; p = ME_FindItemFwd(p, diRunOrParagraphOrEnd); } - if (!ME_StreamOutPrint(pStream, "}")) + if (!ME_StreamOutMove(pStream, "}\0", 2)) return FALSE; return TRUE; }
http://bugs.winehq.org/show_bug.cgi?id=14827
--- Comment #19 from max@veneto.com 2009-04-24 01:46:32 --- (In reply to comment #17)
I don't have AutoCAD 2005 to test, so I can will make a guess as to why the callback function may read more bytes than the amount written. The callback may be looking for a NULL byte to determine the amount of bytes written, instead of looking at the using the cb value.
Try making the following change to add the NULL byte that native richedit controls include, and see if the fixme message still gets printed for the *pcd value.
......
eheheh... that was the first stuff I've thought.... It works, I mean, adding the NULL byte make app read the correct amount of bytes (so, I guess that one is the correct behaviour) but it hangs anyways with 100% cpu as before. So, I guess the real bug is another one, even if the null byte is (IMHO) still needed.
I've tryed many stuffs, from a complete +rich*** log, +ole*** log, many embedded print messages in all calls (ole has very few TRACEs, indeed....), but I couldn't manage to make it work. Richedit (and OLE) logs just shows that the app hangs returning from message handling function, but I couldn't find if it's inside Autocad (I think so...) or inside wine code. Autocad don't run with +relay, and the usage of a BackTrace() embedded function ( seet devel mailing list) didn't help too much.
@Austin : the log (with many printf() messages added) is already here, the first attachment. As you can see, it shows nothing :-(
Suppressing the \fonttbl output makes autocad work almost perfectly (there are some other unrelated bugs in richedit code). Native riched20 didn't help either, as already told here.
Ciao
Max
http://bugs.winehq.org/show_bug.cgi?id=14827
--- Comment #20 from Austin English austinenglish@gmail.com 2009-04-24 10:45:19 --- (In reply to comment #19)
@Austin : the log (with many printf() messages added) is already here, the first attachment. As you can see, it shows nothing :-(
Unless you changed every single warn/err/trace to a fixme, you're missing some output. Running with +richedit it much easier/faster.
Suppressing the \fonttbl output makes autocad work almost perfectly (there are some other unrelated bugs in richedit code). Native riched20 didn't help either, as already told here.
What about riched30?
http://bugs.winehq.org/show_bug.cgi?id=14827
--- Comment #21 from max@veneto.com 2009-04-25 04:48:41 --- (In reply to comment #20)
(In reply to comment #19)
@Austin : the log (with many printf() messages added) is already here, the first attachment. As you can see, it shows nothing :-(
Unless you changed every single warn/err/trace to a fixme, you're missing some output. Running with +richedit it much easier/faster.
I did. The added FIXMEs are *in addition* to +richedit logs... I did also +richole and so on.
Suppressing the \fonttbl output makes autocad work almost perfectly (there are some other unrelated bugs in richedit code). Native riched20 didn't help either, as already told here.
What about riched30?
Also tried, no way. BTW, I found the cause of the bug.... I'll do some testing on native one and then post the correct patch.... I guess some AutoCAD parts were written by some brain-damaged people, indeed. They work just because of M$ richedit quirks.....
Ciao
Max
http://bugs.winehq.org/show_bug.cgi?id=14827
--- Comment #22 from max@veneto.com 2009-04-25 12:57:07 --- Fix sent to wine-patches.
Ciao
Max
http://bugs.winehq.org/show_bug.cgi?id=14827
max@veneto.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution| |FIXED
--- Comment #23 from max@veneto.com 2009-04-27 10:06:02 --- Fix committed.
http://bugs.winehq.org/show_bug.cgi?id=14827
Alexandre Julliard julliard@winehq.org changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |CLOSED
--- Comment #24 from Alexandre Julliard julliard@winehq.org 2009-05-08 12:46:51 --- Closing bugs fixed in 1.1.21.
https://bugs.winehq.org/show_bug.cgi?id=14827
Anastasius Focht focht@gmx.net changed:
What |Removed |Added ---------------------------------------------------------------------------- Fixed by SHA1| |6f173277281476b4872127bfaf2 | |f679d8f10ae96 CC| |focht@gmx.net Version|unspecified |1.1.2 Component|-unknown |richedit