@@ -253,26 +253,39 @@ internal class OpenWindowListHandler : CommandHandler
253
253
protected override void Update ( CommandArrayInfo info )
254
254
{
255
255
foreach ( Components . Window window in IdeApp . CommandService . TopLevelWindowStack ) {
256
+
257
+ string title = null ;
258
+ bool hasTopLevel = false ;
259
+
260
+ try {
261
+ title = window . Title ;
262
+ hasTopLevel = window . HasTopLevelFocus ;
256
263
#if ! WINDOWS
257
- //we don't want include hidden windows
258
- if ( ! window . IsRealized || ! window . IsVisible || Components . Mac . GtkMacInterop . IsGdkQuartzWindow ( window ) )
259
- continue ;
264
+ //we don't want include hidden windows
265
+ if ( ! window . IsRealized || ! window . IsVisible || Components . Mac . GtkMacInterop . IsGdkQuartzWindow ( window ) )
266
+ continue ;
260
267
#endif
268
+ } catch ( System . ObjectDisposedException ex ) {
269
+ LoggingService . LogInternalError ( ex ) ;
270
+ //we log the issue
271
+ continue ;
272
+ }
273
+
261
274
262
275
//Create CommandInfo object
263
276
var commandInfo = new CommandInfo ( ) ;
264
- commandInfo . Text = window . Title . Replace ( "_" , "__" ) . Replace ( "-" , "\u2013 " ) . Replace ( " \u2013 " + BrandingService . ApplicationName , "" ) ;
277
+ commandInfo . Text = title . Replace ( "_" , "__" ) . Replace ( "-" , "\u2013 " ) . Replace ( " \u2013 " + BrandingService . ApplicationName , "" ) ;
265
278
266
279
if ( string . IsNullOrEmpty ( commandInfo . Text ) ) {
267
280
commandInfo . Text = GettextCatalog . GetString ( "No description" ) ;
268
281
}
269
282
270
- if ( window . HasTopLevelFocus )
283
+ if ( hasTopLevel )
271
284
commandInfo . Checked = true ;
272
285
commandInfo . Description = GettextCatalog . GetString ( "Activate window '{0}'" , commandInfo . Text ) ;
273
286
274
287
//Add menu item
275
- info . Add ( commandInfo , window . Title ) ;
288
+ info . Add ( commandInfo , title ) ;
276
289
}
277
290
}
278
291
0 commit comments