Fix crash in event loop nesting.
This commit is contained in:
		
							parent
							
								
									a0926f2d70
								
							
						
					
					
						commit
						6c17ed2242
					
				
					 3 changed files with 14 additions and 6 deletions
				
			
		|  | @ -11,6 +11,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL | ||||||
| #include "mainwidget.h" | #include "mainwidget.h" | ||||||
| #include "history/history_widget.h" | #include "history/history_widget.h" | ||||||
| #include "core/crash_reports.h" | #include "core/crash_reports.h" | ||||||
|  | #include "core/sandbox.h" | ||||||
| #include "storage/localstorage.h" | #include "storage/localstorage.h" | ||||||
| #include "mainwindow.h" | #include "mainwindow.h" | ||||||
| #include "history/history_location_manager.h" | #include "history/history_location_manager.h" | ||||||
|  | @ -38,10 +39,12 @@ public: | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	bool nativeEventFilter(const QByteArray &eventType, void *message, long *result) { | 	bool nativeEventFilter(const QByteArray &eventType, void *message, long *result) { | ||||||
| 		auto wnd = App::wnd(); | 		return Core::Sandbox::Instance().customEnterFromEventLoop([&] { | ||||||
| 		if (!wnd) return false; | 			auto wnd = App::wnd(); | ||||||
|  | 			if (!wnd) return false; | ||||||
| 
 | 
 | ||||||
| 		return wnd->psFilterNativeEvent(message); | 			return wnd->psFilterNativeEvent(message); | ||||||
|  | 		}); | ||||||
| 	} | 	} | ||||||
| }; | }; | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -9,6 +9,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL | ||||||
| 
 | 
 | ||||||
| #include "mainwindow.h" | #include "mainwindow.h" | ||||||
| #include "mainwidget.h" | #include "mainwidget.h" | ||||||
|  | #include "core/sandbox.h" | ||||||
| #include "core/application.h" | #include "core/application.h" | ||||||
| #include "core/crash_reports.h" | #include "core/crash_reports.h" | ||||||
| #include "storage/localstorage.h" | #include "storage/localstorage.h" | ||||||
|  | @ -184,9 +185,11 @@ ApplicationDelegate *_sharedDelegate = nil; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| - (void) mediaKeyTap:(SPMediaKeyTap*)keyTap receivedMediaKeyEvent:(NSEvent*)e { | - (void) mediaKeyTap:(SPMediaKeyTap*)keyTap receivedMediaKeyEvent:(NSEvent*)e { | ||||||
| 	if (e && [e type] == NSSystemDefined && [e subtype] == SPSystemDefinedEventMediaKeys) { | 	Core::Sandbox::Instance().customEnterFromEventLoop([&] { | ||||||
| 		objc_handleMediaKeyEvent(e); | 		if (e && [e type] == NSSystemDefined && [e subtype] == SPSystemDefinedEventMediaKeys) { | ||||||
| 	} | 			objc_handleMediaKeyEvent(e); | ||||||
|  | 		} | ||||||
|  | 	}); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| - (void) ignoreApplicationActivationRightNow { | - (void) ignoreApplicationActivationRightNow { | ||||||
|  |  | ||||||
|  | @ -15,6 +15,8 @@ class Manager; | ||||||
| class Basic final { | class Basic final { | ||||||
| public: | public: | ||||||
| 	Basic() = default; | 	Basic() = default; | ||||||
|  | 	Basic(const Basic &other) = delete; | ||||||
|  | 	Basic &operator=(const Basic &other) = delete; | ||||||
| 
 | 
 | ||||||
| 	template <typename Callback> | 	template <typename Callback> | ||||||
| 	explicit Basic(Callback &&callback); | 	explicit Basic(Callback &&callback); | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		
		Reference in a new issue
	
	 John Preston
						John Preston