Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mac port updates and general cleanups and fixes #2

Merged
merged 4 commits into from
Aug 6, 2018

Conversation

michaelweiser
Copy link
Contributor

This changeset updates the Mac port and fixes long standing right mouse button problems. The latter leads to a general cleanup of the right mouse button logic by moving from abusing the context menu logic to proper right mouse button press/release tracking.

Switch to Qt 5.11.1 and postgres 10.4. This makes all patching
unnecessary since it's all been fixed upstream.

Incidentally remove the need to specify SRC_DIR when building outside
the source.
With current Qt it does not seem to be necessary any more to hide menus
and menu items which have been merged into the system menu. Indeed it's
even harmful in that it disables the merged menu item in question so it
can't be used.
The mac port exposed early on that using the context menu logic to
intercept right button presses is horribly broken. We used to patch Qt
to work around this but that never fully solved the problem.

Additional debugging now shows that signal customContextMenuRequested()
fires on the mouse button press already and does not wait for the
release. This causes the event handling and mouse button state tracking
inside Qt to become corrupted. This in turn causes "ghost" button
presses to happen once the account dialog is closed again and actual
button presses to be ignored.

It is unclear why this only happens on the Mac. From looking at the Qt
code this should also affect other OSes.

This change switches to actual tracking of right mouse button presses
and matching releases and emitting a custom itemRightClicked() signal.

Looking at the Qt code also assures us that itemClicked() only fires on
left button clicks and makes sure that the item delivered to the slot is
valid. This allows us to get rid of some other cruft such as
getCurrentButton().
@desperadoduck desperadoduck merged commit 6b031eb into scVENUS:master Aug 6, 2018
michaelweiser added a commit to michaelweiser/sctime that referenced this pull request May 26, 2020
When sctime-offline.json does not exist, sctime would die with an error
at startup:

terminate called after throwing an instance of 'JSONReaderException*'
Aborted (core dumped)

gdb reveals that it's related to loadDataNewerThan() and getByteArray()
(which makes sense because they're the only places, exceptions are
used):

(gdb) bt
 #0  0x00007ffff669ab01 in raise () from /lib64/libc.so.6
 scVENUS#1  0x00007ffff6684537 in abort () from /lib64/libc.so.6
 scVENUS#2  0x00007ffff6a0c8ce in ?? () from /usr/lib/gcc/x86_64-pc-linux-gnu/10.1.0/libstdc++.so.6
 scVENUS#3  0x00007ffff6a3b7d6 in ?? () from /usr/lib/gcc/x86_64-pc-linux-gnu/10.1.0/libstdc++.so.6
 scVENUS#4  0x00007ffff6a3b841 in std::terminate() () from /usr/lib/gcc/x86_64-pc-linux-gnu/10.1.0/libstdc++.so.6
 scVENUS#5  0x00007ffff6a3bad3 in __cxa_throw () from /usr/lib/gcc/x86_64-pc-linux-gnu/10.1.0/libstdc++.so.6
 scVENUS#6  0x0000555555576cbe in JSONReaderFile::getByteArray() [clone .cold] ()
 scVENUS#7  0x00005555555b4afc in JSONReaderBase::loadDataNewerThan(int) ()
 scVENUS#8  0x00005555555b4a6a in JSONSource::read(QList<QStringList>*) ()
 scVENUS#9  0x000055555558121f in DatasourceManager::start() ()
 scVENUS#10 0x00007ffff6eef5aa in QObject::event(QEvent*) () from /usr/lib64/libQt5Core.so.5
 scVENUS#11 0x00007ffff7a7703f in QApplicationPrivate::notify_helper(QObject*, QEvent*) () from /usr/lib64/libQt5Widgets.so.5
 scVENUS#12 0x00007ffff6ec89c0 in QCoreApplication::notifyInternal2(QObject*, QEvent*) () from /usr/lib64/libQt5Core.so.5
 scVENUS#13 0x00007ffff6ecb5ea in QCoreApplicationPrivate::sendPostedEvents(QObject*, int, QThreadData*) () from /usr/lib64/libQt5Core.so.5
 scVENUS#14 0x00007ffff6f12f13 in ?? () from /usr/lib64/libQt5Core.so.5
 scVENUS#15 0x00007ffff5ab543b in g_main_context_dispatch () from /usr/lib64/libglib-2.0.so.0
 scVENUS#16 0x00007ffff5ab56e8 in ?? () from /usr/lib64/libglib-2.0.so.0
 scVENUS#17 0x00007ffff5ab579f in g_main_context_iteration () from /usr/lib64/libglib-2.0.so.0
 scVENUS#18 0x00007ffff6f129cb in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib64/libQt5Core.so.5
 scVENUS#19 0x00007ffff6ec743b in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib64/libQt5Core.so.5
 scVENUS#20 0x00007ffff6ecedf2 in QCoreApplication::exec() () from /usr/lib64/libQt5Core.so.5
 scVENUS#21 0x0000555555577c2f in main ()

The error is fixed by changing the variable in the catch statement in
loadDataNewerThan() from reference to pointer since that is what new returns in
getByteArray().

Alternatively, the exception could be a static (global?) object to which
a reference can be taken.

Signed-off-by: Michael Weiser <michael.weiser@gmx.de>
desperadoduck pushed a commit that referenced this pull request Nov 4, 2020
When sctime-offline.json does not exist, sctime would die with an error
at startup:

terminate called after throwing an instance of 'JSONReaderException*'
Aborted (core dumped)

gdb reveals that it's related to loadDataNewerThan() and getByteArray()
(which makes sense because they're the only places, exceptions are
used):

(gdb) bt
 #0  0x00007ffff669ab01 in raise () from /lib64/libc.so.6
 #1  0x00007ffff6684537 in abort () from /lib64/libc.so.6
 #2  0x00007ffff6a0c8ce in ?? () from /usr/lib/gcc/x86_64-pc-linux-gnu/10.1.0/libstdc++.so.6
 #3  0x00007ffff6a3b7d6 in ?? () from /usr/lib/gcc/x86_64-pc-linux-gnu/10.1.0/libstdc++.so.6
 #4  0x00007ffff6a3b841 in std::terminate() () from /usr/lib/gcc/x86_64-pc-linux-gnu/10.1.0/libstdc++.so.6
 #5  0x00007ffff6a3bad3 in __cxa_throw () from /usr/lib/gcc/x86_64-pc-linux-gnu/10.1.0/libstdc++.so.6
 #6  0x0000555555576cbe in JSONReaderFile::getByteArray() [clone .cold] ()
 #7  0x00005555555b4afc in JSONReaderBase::loadDataNewerThan(int) ()
 #8  0x00005555555b4a6a in JSONSource::read(QList<QStringList>*) ()
 #9  0x000055555558121f in DatasourceManager::start() ()
 #10 0x00007ffff6eef5aa in QObject::event(QEvent*) () from /usr/lib64/libQt5Core.so.5
 #11 0x00007ffff7a7703f in QApplicationPrivate::notify_helper(QObject*, QEvent*) () from /usr/lib64/libQt5Widgets.so.5
 #12 0x00007ffff6ec89c0 in QCoreApplication::notifyInternal2(QObject*, QEvent*) () from /usr/lib64/libQt5Core.so.5
 #13 0x00007ffff6ecb5ea in QCoreApplicationPrivate::sendPostedEvents(QObject*, int, QThreadData*) () from /usr/lib64/libQt5Core.so.5
 #14 0x00007ffff6f12f13 in ?? () from /usr/lib64/libQt5Core.so.5
 #15 0x00007ffff5ab543b in g_main_context_dispatch () from /usr/lib64/libglib-2.0.so.0
 #16 0x00007ffff5ab56e8 in ?? () from /usr/lib64/libglib-2.0.so.0
 #17 0x00007ffff5ab579f in g_main_context_iteration () from /usr/lib64/libglib-2.0.so.0
 #18 0x00007ffff6f129cb in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib64/libQt5Core.so.5
 #19 0x00007ffff6ec743b in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib64/libQt5Core.so.5
 #20 0x00007ffff6ecedf2 in QCoreApplication::exec() () from /usr/lib64/libQt5Core.so.5
 #21 0x0000555555577c2f in main ()

The error is fixed by changing the variable in the catch statement in
loadDataNewerThan() from reference to pointer since that is what new returns in
getByteArray().

Alternatively, the exception could be a static (global?) object to which
a reference can be taken.

Signed-off-by: Michael Weiser <michael.weiser@gmx.de>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants