1616use Boson \Event \ApplicationStopped ;
1717use Boson \Event \ApplicationStopping ;
1818use Boson \Exception \ApplicationException ;
19- use Boson \Exception \NoDefaultWindowException ;
19+ use Boson \Exception \WindowDereferenceException ;
2020use Boson \Extension \Exception \ExtensionNotFoundException ;
2121use Boson \Extension \Registry ;
22- use Boson \Internal \Poller \SaucerPoller ;
22+ use Boson \Internal \Poller \ApplicationOrderedPoller ;
2323use Boson \Poller \PollerInterface ;
2424use Boson \Shared \Marker \BlockingOperation ;
2525use Boson \Shared \Marker \RequiresDealloc ;
@@ -85,11 +85,11 @@ class Application implements
8585 /**
8686 * Gets the default window of the application.
8787 *
88- * @throws NoDefaultWindowException in case the default window was
88+ * @throws WindowDereferenceException in case the default window was
8989 * already closed and removed earlier
9090 */
9191 get => $ this ->windows ->default
92- ?? throw NoDefaultWindowException ::becauseNoDefaultWindow ();
92+ ?? throw WindowDereferenceException ::becauseNoDefaultWindow ();
9393 }
9494
9595 /**
@@ -102,7 +102,7 @@ class Application implements
102102 /**
103103 * Gets the webview manager of the default application window.
104104 *
105- * @throws NoDefaultWindowException in case the default window was
105+ * @throws WindowDereferenceException in case the default window was
106106 * already closed and removed earlier
107107 */
108108 get => $ this ->window ->webviews ;
@@ -118,7 +118,7 @@ class Application implements
118118 /**
119119 * Gets the WebView instance associated with the default window.
120120 *
121- * @throws NoDefaultWindowException in case the default window was
121+ * @throws WindowDereferenceException in case the default window was
122122 * already closed and removed earlier
123123 */
124124 get => $ this ->window ->webview ;
@@ -187,24 +187,6 @@ public function __construct(
187187 */
188188 public readonly ApplicationCreateInfo $ info = new ApplicationCreateInfo (),
189189 ?EventDispatcherInterface $ dispatcher = null ,
190- /**
191- * @var array<array-key, mixed>
192- *
193- * @deprecated doesn't affect anything anymore and will be removed in future versions
194- */
195- private readonly array $ bootHandlers = [],
196- /**
197- * @var array<array-key, mixed>
198- *
199- * @deprecated doesn't affect anything anymore and will be removed in future versions
200- */
201- private readonly array $ quitHandlers = [],
202- /**
203- * @var array<array-key, mixed>
204- *
205- * @deprecated doesn't affect anything anymore and will be removed in future versions
206- */
207- private readonly array $ deferRunners = [],
208190 ) {
209191 // Initialization Application's fields and properties
210192 $ this ->isDebug = $ this ->createIsDebugParameter ($ info ->debug );
@@ -217,8 +199,8 @@ public function __construct(
217199 $ this ->poller = $ this ->createApplicationPoller ($ this ->saucer );
218200
219201 // Initialization of Application's API
220- $ this ->extensions = new Registry ($ this , $ this ->listener , $ info ->extensions );
221- foreach ($ this ->extensions ->boot () as $ property => $ extension ) {
202+ $ this ->extensions = new Registry ($ this ->listener , $ info ->extensions );
203+ foreach ($ this ->extensions ->boot ($ this ) as $ property => $ extension ) {
222204 // Direct access to dynamic property is 5+ times
223205 // faster than magic `__get` call.
224206 $ this ->__set ($ property , $ extension );
@@ -252,7 +234,7 @@ public function has(string $id): bool
252234 */
253235 protected function createApplicationPoller (SaucerInterface $ saucer ): PollerInterface
254236 {
255- $ poller = new SaucerPoller ($ this ->id , $ saucer );
237+ $ poller = new ApplicationOrderedPoller ($ this ->id , $ saucer );
256238
257239 $ poller ->defer (function (): void {
258240 $ this ->isRunning = true ;
@@ -499,8 +481,6 @@ public function quit(): void
499481 }
500482
501483 $ this ->isRunning = false ;
502- $ this ->saucer ->saucer_application_quit ($ this ->id ->ptr );
503-
504484 $ this ->listener ->dispatch (new ApplicationStopped ($ this ));
505485 }
506486
@@ -514,10 +494,11 @@ public function __destruct()
514494 {
515495 $ this ->quit ();
516496
517- $ this ->windows ->destroy ();
518497 $ this ->extensions ->destroy ();
498+ $ this ->windows ->destroy ();
499+
500+ $ this ->listener ->removeAllEventListeners ();
519501
520- var_dump (__METHOD__ );
521502 $ this ->saucer ->saucer_application_quit ($ this ->id ->ptr );
522503 }
523504
0 commit comments