Commit 8e9eb69
committed
Freeze singleton class chain
The following code:
```ruby
x = Object.new
sc1 = x.singleton_class
sc2 = sc1.singleton_class
x.freeze
```
Would freeze sc1 but not sc2, even though sc1 would be frozen.
Handle this by walking the class pointer chain for the object.
If the class is a singleton class, and it isn't frozen, and the
attached object for the singleton class is the object, the
singleton class should be frozen, and we move to the next iteration.
Fixes [Bug #20319]1 parent b479c41 commit 8e9eb69
2 files changed
Lines changed: 54 additions & 10 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2884 | 2884 | | |
2885 | 2885 | | |
2886 | 2886 | | |
2887 | | - | |
2888 | | - | |
2889 | | - | |
2890 | | - | |
2891 | | - | |
2892 | | - | |
2893 | | - | |
2894 | | - | |
2895 | | - | |
2896 | | - | |
| 2887 | + | |
| 2888 | + | |
| 2889 | + | |
| 2890 | + | |
| 2891 | + | |
| 2892 | + | |
| 2893 | + | |
| 2894 | + | |
| 2895 | + | |
| 2896 | + | |
| 2897 | + | |
| 2898 | + | |
2897 | 2899 | | |
2898 | 2900 | | |
2899 | 2901 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1025 | 1025 | | |
1026 | 1026 | | |
1027 | 1027 | | |
| 1028 | + | |
| 1029 | + | |
| 1030 | + | |
| 1031 | + | |
| 1032 | + | |
| 1033 | + | |
| 1034 | + | |
| 1035 | + | |
| 1036 | + | |
| 1037 | + | |
| 1038 | + | |
| 1039 | + | |
| 1040 | + | |
| 1041 | + | |
| 1042 | + | |
| 1043 | + | |
| 1044 | + | |
| 1045 | + | |
| 1046 | + | |
| 1047 | + | |
| 1048 | + | |
| 1049 | + | |
| 1050 | + | |
| 1051 | + | |
| 1052 | + | |
| 1053 | + | |
| 1054 | + | |
| 1055 | + | |
| 1056 | + | |
| 1057 | + | |
| 1058 | + | |
| 1059 | + | |
| 1060 | + | |
| 1061 | + | |
| 1062 | + | |
| 1063 | + | |
| 1064 | + | |
| 1065 | + | |
| 1066 | + | |
| 1067 | + | |
| 1068 | + | |
| 1069 | + | |
1028 | 1070 | | |
1029 | 1071 | | |
1030 | 1072 | | |
| |||
0 commit comments