@@ -129,9 +129,13 @@ void UINotifications::OnViewChange(UIContext* context, ViewFrame* frame, const Q
129129 uint64_t addr = 0 ;
130130 if (GetAddressInput (addr, " Address" , " Address" ))
131131 {
132- BackgroundThread::create (ctx.context ->mainWindow ())
133- ->thenBackground ([ctx, addr]() {
134- loadImageAtAddr (*ctx.binaryView , addr);
132+ auto view = ctx.binaryView ;
133+ if (!view)
134+ return ;
135+ auto owner = ctx.context ? ctx.context ->mainWindow () : nullptr ;
136+ BackgroundThread::create (owner)
137+ ->thenBackground ([view, addr]() {
138+ loadImageAtAddr (*view, addr);
135139 })->start ();
136140 }
137141 };
@@ -140,23 +144,35 @@ void UINotifications::OnViewChange(UIContext* context, ViewFrame* frame, const Q
140144 uint64_t addr = 0 ;
141145 if (GetAddressInput (addr, " Address" , " Address" ))
142146 {
143- BackgroundThread::create (ctx.context ->mainWindow ())
144- ->thenBackground ([ctx, addr](){ loadRegionAtAddr (*ctx.binaryView , addr); })
147+ auto view = ctx.binaryView ;
148+ if (!view)
149+ return ;
150+ auto owner = ctx.context ? ctx.context ->mainWindow () : nullptr ;
151+ BackgroundThread::create (owner)
152+ ->thenBackground ([view, addr](){ loadRegionAtAddr (*view, addr); })
145153 ->start ();
146154 }
147155 };
148156
149157 auto loadRegionTokenAction = [](const UIActionContext& ctx) {
158+ auto view = ctx.binaryView ;
159+ if (!view)
160+ return ;
150161 uint64_t addr = TokenAddress (ctx);
151- BackgroundThread::create (ctx.context ->mainWindow ())
152- ->thenBackground ([ctx, addr](){ loadRegionAtAddr (*ctx.binaryView , addr); })
162+ auto owner = ctx.context ? ctx.context ->mainWindow () : nullptr ;
163+ BackgroundThread::create (owner)
164+ ->thenBackground ([view, addr](){ loadRegionAtAddr (*view, addr); })
153165 ->start ();
154166 };
155167
156168 auto loadImageTokenAction = [](const UIActionContext& ctx) {
169+ auto view = ctx.binaryView ;
170+ if (!view)
171+ return ;
157172 uint64_t addr = TokenAddress (ctx);
158- BackgroundThread::create (ctx.context ->mainWindow ())
159- ->thenBackground ([ctx, addr](){ loadImageAtAddr (*ctx.binaryView , addr); })
173+ auto owner = ctx.context ? ctx.context ->mainWindow () : nullptr ;
174+ BackgroundThread::create (owner)
175+ ->thenBackground ([view, addr](){ loadImageAtAddr (*view, addr); })
160176 ->start ();
161177 };
162178
0 commit comments