Tk Source Code

Check-in [b5bee92c]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:[Bug 3588824]: bug in image index handling for weird image names

Checkin leaves test text-8.22 segfaulting. Moved to 'mistake' branch.

Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | mistake
Files: files | file ages | folders
SHA1: b5bee92cab60420d32ed1e322dfe01a723a3b9f3
User & Date: fvogel 2012-12-03 01:31:24
Original Comment: [Bug 3588824]: bug in image index handling for weird image names
Context
2012-12-03
20:53
Add NULL protections; stops segfaults Closed-Leaf check-in: d2a35aa1 user: dgp tags: mistake
01:31
[Bug 3588824]: bug in image index handling for weird image names

Checkin leaves test text-8.22 segfaulting. Moved to 'mistake' branch. check-in: b5bee92c user: fvogel tags: mistake

01:27
[Bug 3588824]: bug in image index handling for weird image names check-in: c0d69e37 user: fvogel tags: mistake
01:22
merge-mark check-in: b7d2e2b8 user: fvogel tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to ChangeLog.






1
2
3
4
5
6
7





2012-11-14  Jan Nijtmans  <[email protected]>

	* win/tkWinDialog.c: [Bug 3500545]: tk_getOpenFile -multiple 1 wrong
	on windows

2012-11-11  Jan Nijtmans  <[email protected]>

>
>
>
>
>







1
2
3
4
5
6
7
8
9
10
11
12
2012-12-03  Francois Vogel  <[email protected]>

   * generic/tkTextIndex.c: [Bug 3588824]: bug in image index handling
   * tests/textIndex.test:  for weird image names

2012-11-14  Jan Nijtmans  <[email protected]>

	* win/tkWinDialog.c: [Bug 3500545]: tk_getOpenFile -multiple 1 wrong
	on windows

2012-11-11  Jan Nijtmans  <[email protected]>

Changes to generic/tkTextIndex.c.

756
757
758
759
760
761
762
763

764

765
766
767
768
769
770
771








772
773
774
775
776
777
778

    if (sharedPtr == NULL) {
	sharedPtr = textPtr->sharedTextPtr;
    }

    /*
     *---------------------------------------------------------------------
     * Stage 1: check to see if the index consists of nothing but a mark name.

     * We do this check now even though it's also done later, in order to

     * allow mark names that include funny characters such as spaces or "+1c".
     *---------------------------------------------------------------------
     */

    if (TkTextMarkNameToIndex(textPtr, string, indexPtr) == TCL_OK) {
	goto done;
    }









    /*
     *------------------------------------------------
     * Stage 2: start again by parsing the base index.
     *------------------------------------------------
     */








|
>
|
>
|






>
>
>
>
>
>
>
>







756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788

    if (sharedPtr == NULL) {
	sharedPtr = textPtr->sharedTextPtr;
    }

    /*
     *---------------------------------------------------------------------
     * Stage 1: check to see if the index consists of nothing but a mark
     * name, an embedded window or an embedded image.  We do this check
     * now even though it's also done later, in order to allow mark names,
     * embedded window names or image names that include funny characters
     * such as spaces or "+1c".
     *---------------------------------------------------------------------
     */

    if (TkTextMarkNameToIndex(textPtr, string, indexPtr) == TCL_OK) {
	goto done;
    }

    if (TkTextWindowIndex(textPtr, string, indexPtr) != 0) {
	goto done;
    }

    if (TkTextImageIndex(textPtr, string, indexPtr) != 0) {
	goto done;
    }

    /*
     *------------------------------------------------
     * Stage 2: start again by parsing the base index.
     *------------------------------------------------
     */

Changes to tests/textIndex.test.

210
211
212
213
214
215
216





217
218
219

















220
221
222
223
224
225
226
.t tag add x 2.8 2.11
.t tag add x 6.0 6.2
set weirdTag "funny . +- 22.1\n\t{"
.t tag add $weirdTag 2.1  2.6
set weirdMark "asdf \n{-+ 66.2\t"
.t mark set $weirdMark 4.0
.t tag config y -relief raised





test textIndex-3.1 {TkTextGetIndex, weird mark names} {
    list [catch {.t index $weirdMark} msg] $msg
} {0 4.0}


















test textIndex-4.1 {TkTextGetIndex, tags} {
    list [catch {.t index x.first} msg] $msg
} {0 2.8}
test textIndex-4.2 {TkTextGetIndex, tags} {
    list [catch {.t index x.last} msg] $msg
} {0 6.2}







>
>
>
>
>



>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
.t tag add x 2.8 2.11
.t tag add x 6.0 6.2
set weirdTag "funny . +- 22.1\n\t{"
.t tag add $weirdTag 2.1  2.6
set weirdMark "asdf \n{-+ 66.2\t"
.t mark set $weirdMark 4.0
.t tag config y -relief raised
set weirdImage "foo-1"
.t image create 2.1 -image [image create photo $weirdImage]
set weirdEmbWin ".t.bar-1"
entry $weirdEmbWin
.t window create 3.1 -window $weirdEmbWin
test textIndex-3.1 {TkTextGetIndex, weird mark names} {
    list [catch {.t index $weirdMark} msg] $msg
} {0 4.0}
test textIndex-3.2 {TkTextGetIndex, weird mark names} knownBug {
    list [catch {.t index "$weirdMark -1char"} msg] $msg
} {0 4.0}
test textIndex-3.3 {TkTextGetIndex, weird embedded window names} {
    list [catch {.t index $weirdEmbWin} msg] $msg
} {0 3.1}
test textIndex-3.4 {TkTextGetIndex, weird embedded window names} knownBug {
    list [catch {.t index "$weirdEmbWin -1char"} msg] $msg
} {0 3.0}
test textIndex-3.5 {TkTextGetIndex, weird image names} {
    list [catch {.t index $weirdImage} msg] $msg
} {0 2.1}
test textIndex-3.6 {TkTextGetIndex, weird image names} knownBug {
    list [catch {.t index "$weirdImage -1char"} msg] $msg
} {0 2.0}
.t delete 3.1  ; # remove the weirdEmbWin
.t delete 2.1  ; # remove the weirdImage

test textIndex-4.1 {TkTextGetIndex, tags} {
    list [catch {.t index x.first} msg] $msg
} {0 2.8}
test textIndex-4.2 {TkTextGetIndex, tags} {
    list [catch {.t index x.last} msg] $msg
} {0 6.2}