#1104 Tk_GetNumMainWindows not as documented

obsolete: 8.3.4
closed-fixed
5
2009-05-05
2001-11-29
Don Porter
No

Tk_GetNumWindows man page says:

Tk_GetNumMainWindows returns a count of the number
of main windows currently open in the process.

It does not do that; rather it returns the number
of main windows in the current thread only.

One effect of this difference can be seen running
this script in tclsh (--enable-threads):

# FILE: test.tcl
package require Thread
load /usr/local/lib/libtk8.3.so Tk
set id [thread::create]
thread::send $id {load {} Tk}
thread::send $id {
pack [label .l -text "I'm the created thread"]
}
# END FILE test.tcl

Destroy the toplevel window that does not contain
the label (the one from the main thread, not the
created thread), and tclsh will exit. This is
because Tk_MainLoop() sees a count of zero main
windows remaining and exits.

Discussion

  • Jeffrey Hobbs

    Jeffrey Hobbs - 2001-12-28
    • assigned_to: hobbs --> dgp
     
  • Jeffrey Hobbs

    Jeffrey Hobbs - 2001-12-28

    Logged In: YES
    user_id=72656

    Since the docs were written before threading, is it
    recommended to change the docs to say "thread" instead
    of "process", or to correct the code?

     
  • Don Porter

    Don Porter - 2001-12-28
    • assigned_to: dgp --> hobbs
     
  • Don Porter

    Don Porter - 2001-12-28

    Logged In: YES
    user_id=80530

    I think it's preferable to fix the code so that
    wish continues to run while windows exist that
    are managed by other threads.

    I don't know whether or not that's difficult.

     
  • Don Porter

    Don Porter - 2002-08-20

    Logged In: YES
    user_id=80530

    FWIW, Tk 8.4b3 still has this problem.

     
  • Nobody/Anonymous

    Logged In: NO

    74167945822222222222222

     
  • Don Porter

    Don Porter - 2003-11-13
    • summary: Tk_GetNumWindows not as documented --> Tk_GetNumMainWindows not as documented
     
  • William L. Dye

    William L. Dye - 2003-11-13

    Logged In: YES
    user_id=18690

    There is a minor typographical error in the subject line of
    this bug report.

    The correct function name is "Tk_GetNumMainWindows".

     
  • Donal K. Fellows

    • assigned_to: hobbs --> dkf
    • status: open --> closed-fixed
     

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks