activitywatch icon indicating copy to clipboard operation
activitywatch copied to clipboard

Exception creating tray icon on mac

Open theguybieber opened this issue 9 years ago • 10 comments

I get the following error creating a tray icon on the mac:

(venv) Guys-MacBook-Pro:activitywatch guybieber$ aw-qt
INFO:aw.qt.manager:Starting module aw-server
INFO:aw.qt.manager:Starting module aw-watcher-afk
INFO:aw.qt.manager:Starting module aw-watcher-window
INFO:root:Creating trayicon...
2017-06-02 07:11:57.228 Python[29273:1089314] *** Assertion failure in -[NSBitmapImageRep initWithCGImage:], /Library/Caches/com.apple.xbs/Sources/AppKit/AppKit-1504.82.104/AppKit.subproj/NSBitmapImageRep.m:1296
2017-06-02 07:11:57.266 Python[29273:1089314] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Invalid parameter not satisfying: cgImage != NULL'
*** First throw call stack:
(
	0   CoreFoundation                      0x00007fffa550962b __exceptionPreprocess + 171
	1   libobjc.A.dylib                     0x00007fffba7461da objc_exception_throw + 48
	2   CoreFoundation                      0x00007fffa550e182 +[NSException raise:format:arguments:] + 98
	3   Foundation                          0x00007fffa6f74ce0 -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 195
	4   AppKit                              0x00007fffa30c9986 -[NSBitmapImageRep initWithCGImage:] + 149
	5   QtGui                               0x0000000104cbaabd _Z21qt_mac_create_nsimageRK5QIconi + 525
	6   libqcocoa.dylib                     0x00000001078e6fda qt_plugin_instance + 154170
	7   libqcocoa.dylib                     0x00000001078e4197 qt_plugin_instance + 142327
	8   QtWidgets                           0x00000001045ba9e9 _ZN5QMenu15setPlatformMenuEP13QPlatformMenu + 537
	9   QtWidgets                           0x00000001047c52cd _ZN15QSystemTrayIcon14messageClickedEv + 909
	10  QtWidgets                           0x00000001047c51ca _ZN15QSystemTrayIcon14messageClickedEv + 650
	11  QtWidgets.so                        0x000000010405986c _ZL35meth_QSystemTrayIcon_setContextMenuP7_objectS0_ + 108
	12  Python                              0x000000010006a688 _PyCFunction_FastCallDict + 568
	13  Python                              0x00000001000f33e4 call_function + 612
	14  Python                              0x00000001000f8d84 _PyEval_EvalFrameDefault + 21892
	15  Python                              0x00000001000f27a0 _PyEval_EvalCodeWithName + 2720
	16  Python                              0x00000001000f3636 _PyFunction_FastCallDict + 422
	17  Python                              0x000000010000e984 _PyObject_FastCallDict + 356
	18  Python                              0x000000010000eaa0 _PyObject_Call_Prepend + 208
	19  Python                              0x000000010000e5b3 PyObject_Call + 99
	20  Python                              0x0000000100089871 slot_tp_init + 81
	21  Python                              0x0000000100080144 type_call + 212
	22  Python                              0x000000010000e8d4 _PyObject_FastCallDict + 180
	23  Python                              0x000000010000ed00 _PyObject_FastCallKeywords + 288
	24  Python                              0x00000001000f3225 call_function + 165
	25  Python                              0x00000001000f7aa0 _PyEval_EvalFrameDefault + 17056
	26  Python                              0x00000001000f27a0 _PyEval_EvalCodeWithName + 2720
	27  Python                              0x00000001000f2fab fast_function + 219
	28  Python                              0x00000001000f33cb call_function + 587
	29  Python                              0x00000001000f7aa0 _PyEval_EvalFrameDefault + 17056
	30  Python                              0x00000001000f312e fast_function + 606
	31  Python                              0x00000001000f33cb call_function + 587
	32  Python                              0x00000001000f8d84 _PyEval_EvalFrameDefault + 21892
	33  Python                              0x00000001000f27a0 _PyEval_EvalCodeWithName + 2720
	34  Python                              0x00000001000f2944 PyEval_EvalCode + 100
	35  Python                              0x000000010012f21e PyRun_FileExFlags + 206
	36  Python                              0x000000010012f4bf PyRun_SimpleFileExFlags + 447
	37  Python                              0x0000000100148ada Py_Main + 3914
	38  Python                              0x0000000100000dfe Python + 3582
	39  Python                              0x0000000100000c34 Python + 3124
	40  ???                                 0x0000000000000002 0x0 + 2
)
libc++abi.dylib: terminating with uncaught exception of type NSException
Abort trap: 6```

theguybieber avatar Jun 02 '17 14:06 theguybieber

Though all three processes are running the browser interface doesn't seem to do much. Perhaps due to the error above.

activitywatch

theguybieber avatar Jun 02 '17 14:06 theguybieber

Actually, that's how the web interface is supposed to look. I wrote a clearer starting page, but apparently it hasn't been merged into the bundle repo, I'll do that right away.

Clicking the Activity/Bucket buttons should get you to places where you can inspect the data.

I have an idea what might have caused that bug...

On Jun 2, 2017 4:18 PM, "theguybieber" [email protected] wrote:

Though all three processes are running the browser interface doesn't seem to do much. Perhaps due to the error above.

[image: activitywatch] https://cloud.githubusercontent.com/assets/5232944/26729805/a7e00f98-4763-11e7-8c4f-457c0123635a.png

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/ActivityWatch/activitywatch/issues/62#issuecomment-305801793, or mute the thread https://github.com/notifications/unsubscribe-auth/ABVxukO3CkCJuPw-kCncrBC33otEqpsgks5sABmygaJpZM4NuV2_ .

ErikBjare avatar Jun 02 '17 17:06 ErikBjare

Found this eerily similar bug: https://github.com/OtterBrowser/otter-browser/issues/1313

I have a potential fix in https://github.com/ActivityWatch/aw-qt/pull/15

ErikBjare avatar Jun 02 '17 17:06 ErikBjare

The system is collecting data and I can view it under activity then clicking my macbook. Very cool. It would be cool if the main page went right to the data and also showed the status of the service (right now it shows all the status options).

theguybieber avatar Jun 02 '17 18:06 theguybieber

I get it the status stuff is a placeholder.

theguybieber avatar Jun 02 '17 18:06 theguybieber

Yeah, I agree. The start page is something we'll have to design better.

ErikBjare avatar Jun 02 '17 19:06 ErikBjare

So, I did a lot of work in order to eliminate future problems like this.

  • I set up basic integration testing for aw-qt: https://github.com/ActivityWatch/aw-qt/pull/14
  • Managed to replicate it: https://travis-ci.org/ActivityWatch/aw-qt/jobs/23893596
  • Implemented a working fix: https://github.com/ActivityWatch/aw-qt/pull/15

So, fixed! Thanks for being our macOS bug catcher @theguybieber ;)

ErikBjare avatar Jun 02 '17 22:06 ErikBjare

Are the changes in https://github.com/ActivityWatch/aw-qt/pull/15 still needed? It seems the qt bug causing the issue mentioned in https://github.com/OtterBrowser/otter-browser/issues/1313 has also been fixed.

Only noticed this issue when packaging aw for NixOS, where I had to add the qtsvg library to have the icon show up. Maybe that could be noted as a dependency on Linux?

huantianad avatar Nov 08 '22 18:11 huantianad

@huantianad Wouldn't surprise me if this has been fixed and the workaround is no longer needed as we've switched from PyQt4 to PyQt6 since.

ErikBjare avatar Nov 08 '22 19:11 ErikBjare

Perhaps someone on macOS could test if this workaround is still needed?

huantianad avatar Nov 08 '22 22:11 huantianad