Commit 0c528fb
authored
Fix crash when changing viewport settings (#4862)
* Fixes #3959
There are two bugs racing each other here, which is why it sometimes
crashes and sometimes the app just silently exists
Bug 1
When the window is recreated a Destroyed event arrives (due to the Drop
of the old window). The code that receives this event does not look to
see if its the main viewport or a secondary one and unconditionally
closes the app. The code path for other platforms is slightly different
and does check.
I have moved the code that handles the destroy to be in the same place
and have the same behavior as the other platforms.
Bug 2
At recreate time the window and winit entries of the viewport are set to
None (forcin g them to be recreated). But the surface is still bound to
the old window, this causes the next context switch to fail. So I simply
added a viewport.gl_surface = None too,
This is my first egui PR so I hope I have not broken anything. If
nothing else I understand a little better how egui works.1 parent 5a196f6 commit 0c528fb
3 files changed
Lines changed: 33 additions & 10 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
236 | 236 | | |
237 | 237 | | |
238 | 238 | | |
239 | | - | |
240 | | - | |
241 | | - | |
242 | | - | |
243 | 239 | | |
244 | 240 | | |
245 | 241 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
803 | 803 | | |
804 | 804 | | |
805 | 805 | | |
| 806 | + | |
| 807 | + | |
| 808 | + | |
| 809 | + | |
| 810 | + | |
| 811 | + | |
| 812 | + | |
| 813 | + | |
| 814 | + | |
| 815 | + | |
| 816 | + | |
| 817 | + | |
806 | 818 | | |
807 | 819 | | |
808 | 820 | | |
| |||
1360 | 1372 | | |
1361 | 1373 | | |
1362 | 1374 | | |
| 1375 | + | |
1363 | 1376 | | |
1364 | 1377 | | |
1365 | 1378 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
158 | 158 | | |
159 | 159 | | |
160 | 160 | | |
| 161 | + | |
161 | 162 | | |
162 | 163 | | |
163 | 164 | | |
| |||
927 | 928 | | |
928 | 929 | | |
929 | 930 | | |
930 | | - | |
931 | | - | |
| 931 | + | |
| 932 | + | |
| 933 | + | |
| 934 | + | |
| 935 | + | |
| 936 | + | |
| 937 | + | |
| 938 | + | |
932 | 939 | | |
933 | 940 | | |
934 | 941 | | |
| |||
1051 | 1058 | | |
1052 | 1059 | | |
1053 | 1060 | | |
1054 | | - | |
| 1061 | + | |
1055 | 1062 | | |
1056 | 1063 | | |
1057 | 1064 | | |
| |||
1084 | 1091 | | |
1085 | 1092 | | |
1086 | 1093 | | |
1087 | | - | |
1088 | | - | |
| 1094 | + | |
| 1095 | + | |
1089 | 1096 | | |
1090 | 1097 | | |
1091 | 1098 | | |
1092 | 1099 | | |
1093 | | - | |
| 1100 | + | |
| 1101 | + | |
1094 | 1102 | | |
1095 | 1103 | | |
1096 | 1104 | | |
| |||
1135 | 1143 | | |
1136 | 1144 | | |
1137 | 1145 | | |
| 1146 | + | |
| 1147 | + | |
| 1148 | + | |
| 1149 | + | |
| 1150 | + | |
| 1151 | + | |
1138 | 1152 | | |
1139 | 1153 | | |
1140 | 1154 | | |
| |||
0 commit comments