Tcl_Main blocks before starting my loop in Tcl_SetMainLoop
Closed / Fixed1481986fffffffffffffffffffffffffffffffffCreated 21 years agoUpdated 21 years ago
Descriptionplain2006-05-04 16:57:19
From: [email protected] (Andrew Lin) After some discussion, DonP thinks it is necessary to patch this misfeature. A quick patch will be appreciated. OS: Redhat Fedora 4 Problem: I use Tcl_SetMainLoop to setup myEventLoop for Qt window. However, Tcl_Main first blocks at tcl prompt "%" instead of starting myEventLoop until I hit RETURN, then myEventLoop starts properly while tcl prompt continues to accept command. Expected: Tcl_Main should enter interactive mode and run myEventLoop without waiting for RETURN at tcl prompt. Sample: Tcl_SetMainLoop(myEventLoop); Tcl_Main(1, argv, Tcl_AppInit);
dgpplain2006-05-05 00:27:13
Logged In: YES user_id=80530 Here's a patch against 8.4.13 to test.
dgpplain2006-05-05 00:27:14
File Added - 176859: 1481986.patch
dgpplain2006-05-05 23:48:04
File Deleted - 176859: File Added - 176962: 1481986.patch Logged In: YES user_id=80530 New patch cleans up the code indentation, and supplies a test case showing the patch works.
dgpplain2006-05-05 23:52:39
Logged In: YES user_id=80530 hmmm.... and now that test case is showing the fix to be incomplete. investigating...
dgpplain2006-05-06 00:02:32
Logged In: YES user_id=80530 I think my testing just went off a bit. Try the patch
nobodyplain2006-05-06 00:58:16
Logged In: NO
Thanks Don, I downloaded 1481986.patch against 8.4.13 but it
still had the same blocking problem. Then I traced down to
Tcl_GetsObj() is actually blocking for RETURN in Tcl_Main,
so I added "if (mainLoopProc == NULL)" to skip that code
segment when Tcl_SetMainLoop is used. With this change, now
Tcl_Main starts myEventLoop properly while giving me the
interactive tcl prompt. Do you expect any side-effect from
this change in tclMain.c?
352a353,354
> // 2006.5.5 alin Do not block if mainLoopProc set
> if (mainLoopProc == NULL) {
374a377
> }
dgpplain2006-05-06 01:06:27
Logged In: YES user_id=80530 Somehow you're not testing the patched version. If you use the patched version, you should not reach Tcl_GetObj() (line 354) because the (mainLoopProc == NULL) test on line 338 should be false and send control on to line 415. Re-check your testing, or use the test suite case in the more recent patch to verify the bug fix.
dgpplain2006-05-06 01:10:25
Logged In: YES user_id=80530 fix committed for 8.4.14 and 8.5a5
nobodyplain2006-05-06 04:04:28
Logged In: NO Yes the new patch is good! After I rebuilt my application, Tcl_Main starts myEventLoop properly while giving me the interactive tcl prompt as expected. Thank you for fixing this problem so quickly, will wait for patch in 8.4.14 release. Thanks, Andrew ([email protected])
Log in (anonymous is fine) to add a comment.
Attachments:
- 1481986.patch [download] added by dgp on 2006-05-05 23:48:04. [details]