Closed arudp closed 3 years ago
The complete error log would be great!
There you go!
Would it be possible for you to compile the project locally and run it there? I'm not able to reproduce the segmentation fault with the linux VM I'm using.
Sure, I'll give it a try as soon as possible
I have compile plugin and have error while runIde task on Ubuntu 20.04:
The error is in the getCurrentTheme
function inside https://github.com/weisJ/auto-dark-mode/blob/master/linux/gnome/src/main/cpp/DarkModeGnome.cpp
I suspect there is a null pointer dereference somewhere. Could you do some checks to see whether settings
or the return value of get_string
is null?
I can confirm that there is error while access settings
object, but i can not figure out how to check if settings
is null, as it not implements logical operators, and i don't know how to debug this code.
Sadly an error pops up when trying to build. I have never worked with Gradle nor have I ever created a plugin, so the best I can do is drop you the log when running with stacktrace
:
Run with
java 16 2021-03-16 Java(TM) SE Runtime Environment (build 16+36-2231) Java HotSpot(TM) 64-Bit Server VM (build 16+36-2231, mixed mode, sharing)
I have also provided the token as instructed in the
gradle.properties
under the keygithubAccessToken
.Hope this helps!
I believe #31 is a duplicate
Given that gsettings comes by default in all glib2 installations, would it maybe advisable to replace the cpp library with binding to jvm with a simple Runtime.getRuntime().exec("gsettings get org.gnome.desktop.interface gtk-theme")
call?
This way the plugin would just need to be provided with which command to run to extract the current theme and it would make it easier to support other desktop environments
About the actual problem, I'm trying to build the plugin locally with a few modifications but failing terribly to start it.
I have been able to build it after several few retries, but the plugin is failing to load on startup:
2021-04-05 20:07:11,741 [ 2844] ERROR - llij.ide.plugins.PluginManager - com.intellij.diagnostic.PluginException: Failed to load class: ServiceAdapter(descriptor=ServiceDescriptor(interface=com.github.weisj.darkmode.platform.ThemeMonitorService, implementation=com.github.weisj.darkmode.platform.linux.LinuxThemeMonitorService), pluginDescriptor=PluginDescriptor(name=Auto Dark Mode, id=com.github.weisj.darkmode, path=/home/javier/.local/share/JetBrains/WebStorm2020.3/auto-dark-mode-plugin, version=1.5.3-2020.3)) [Plugin: com.github.weisj.darkmode]
java.util.concurrent.CompletionException: com.intellij.diagnostic.PluginException: Failed to load class: ServiceAdapter(descriptor=ServiceDescriptor(interface=com.github.weisj.darkmode.platform.ThemeMonitorService, implementation=com.github.weisj.darkmode.platform.linux.LinuxThemeMonitorService), pluginDescriptor=PluginDescriptor(name=Auto Dark Mode, id=com.github.weisj.darkmode, path=/home/javier/.local/share/JetBrains/WebStorm2020.3/auto-dark-mode-plugin, version=1.5.3-2020.3)) [Plugin: com.github.weisj.darkmode]
at java.base/java.util.concurrent.CompletableFuture.encodeThrowable(CompletableFuture.java:314)
at java.base/java.util.concurrent.CompletableFuture.completeThrowable(CompletableFuture.java:319)
at java.base/java.util.concurrent.CompletableFuture$UniRun.tryFire(CompletableFuture.java:787)
at java.base/java.util.concurrent.CompletableFuture.postComplete(CompletableFuture.java:506)
at java.base/java.util.concurrent.CompletableFuture.postFire(CompletableFuture.java:610)
at java.base/java.util.concurrent.CompletableFuture$UniCompose.tryFire(CompletableFuture.java:1085)
at java.base/java.util.concurrent.CompletableFuture$Completion.run(CompletableFuture.java:478)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1$1.run(Executors.java:668)
at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1$1.run(Executors.java:665)
at java.base/java.security.AccessController.doPrivileged(Native Method)
at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1.run(Executors.java:665)
at java.base/java.lang.Thread.run(Thread.java:834)
Caused by: com.intellij.diagnostic.PluginException: Failed to load class: ServiceAdapter(descriptor=ServiceDescriptor(interface=com.github.weisj.darkmode.platform.ThemeMonitorService, implementation=com.github.weisj.darkmode.platform.linux.LinuxThemeMonitorService), pluginDescriptor=PluginDescriptor(name=Auto Dark Mode, id=com.github.weisj.darkmode, path=/home/javier/.local/share/JetBrains/WebStorm2020.3/auto-dark-mode-plugin, version=1.5.3-2020.3)) [Plugin: com.github.weisj.darkmode]
at com.intellij.serviceContainer.BaseComponentAdapter.getImplementationClass(BaseComponentAdapter.kt:44)
at com.intellij.serviceContainer.BaseComponentAdapter.getInstanceUncached(BaseComponentAdapter.kt:107)
at com.intellij.serviceContainer.BaseComponentAdapter.getInstance(BaseComponentAdapter.kt:67)
at com.intellij.serviceContainer.ComponentManagerImpl.doGetService(ComponentManagerImpl.kt:457)
at com.intellij.serviceContainer.ComponentManagerImpl.getService(ComponentManagerImpl.kt:440)
at com.intellij.openapi.components.ServiceManager.getService(ServiceManager.java:21)
at com.github.weisj.darkmode.AutoDarkMode.createMonitor(AutoDarkMode.kt:48)
at com.github.weisj.darkmode.AutoDarkMode.access$createMonitor(AutoDarkMode.kt:43)
at com.github.weisj.darkmode.AutoDarkMode$monitor$1.invoke(AutoDarkMode.kt:45)
at com.github.weisj.darkmode.AutoDarkMode$monitor$1.invoke(AutoDarkMode.kt:43)
at kotlin.SynchronizedLazyImpl.getValue(LazyJVM.kt:74)
at com.github.weisj.darkmode.platform.settings.UtilKt.letValue(Util.kt:49)
at com.github.weisj.darkmode.AutoDarkMode.start(AutoDarkMode.kt:56)
at com.github.weisj.darkmode.AutoDarkModeStartupListener.appFrameCreated(AutoDarkModeStartupListener.kt:34)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at com.intellij.util.messages.impl.MessageBusImpl.invokeListener(MessageBusImpl.java:656)
at com.intellij.util.messages.impl.MessageBusImpl.deliverMessage(MessageBusImpl.java:426)
at com.intellij.util.messages.impl.MessageBusImpl.pumpWaitingBuses(MessageBusImpl.java:401)
at com.intellij.util.messages.impl.MessageBusImpl.pumpMessages(MessageBusImpl.java:383)
at com.intellij.util.messages.impl.MessageBusImpl.access$100(MessageBusImpl.java:33)
at com.intellij.util.messages.impl.MessageBusImpl$MessagePublisher.invoke(MessageBusImpl.java:189)
at com.sun.proxy.$Proxy35.appFrameCreated(Unknown Source)
at com.intellij.idea.IdeStarter.main(IdeStarter.kt:104)
at com.intellij.idea.ApplicationLoader$startApp$8.run(ApplicationLoader.kt:239)
at java.base/java.util.concurrent.CompletableFuture$UniRun.tryFire(CompletableFuture.java:783)
... 11 more
Caused by: java.lang.ClassNotFoundException: com.github.weisj.darkmode.platform.linux.LinuxThemeMonitorService PluginClassLoader[PluginDescriptor(name=Auto Dark Mode, id=com.github.weisj.darkmode, path=/home/javier/.local/share/JetBrains/WebStorm2020.3/auto-dark-mode-plugin, version=1.5.3-2020.3)] com.intellij.ide.plugins.cl.PluginClassLoader@7e781f50
at com.intellij.ide.plugins.cl.PluginClassLoader.loadClass(PluginClassLoader.java:129)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:522)
at java.base/java.lang.Class.forName0(Native Method)
at java.base/java.lang.Class.forName(Class.java:398)
at com.intellij.serviceContainer.BaseComponentAdapter.getImplementationClass(BaseComponentAdapter.kt:41)
... 38 more
Given that gsettings comes by default in all glib2 installations, would it maybe advisable to replace the cpp library with binding to jvm with a simple
Runtime.getRuntime().exec("gsettings get org.gnome.desktop.interface gtk-theme")
call?This way the plugin would just need to be provided with which command to run to extract the current theme and it would make it easier to support other desktop environments
The plugin also registers a callback hook to get notified when the theme changes to adjust the IDE theme automatically. For this the native code is needed.
About the actual problem, I'm trying to build the plugin locally with a few modifications but failing terribly to start it. I have been able to build it after several few retries, but the plugin is failing to load on startup: [...]
There seems to be a task dependency issue with the buildPlugin
task. Even though it depends on the other sub-projects being build they sometimes won't be copied into the distribution folder for the runIde
task. In this case running
gradlew clean build -PisPublished=false
gradlew buildPlugin
would solve the problem for me.
Sadly an error pops up when trying to build. I have never worked with Gradle nor have I ever created a plugin, so the best I can do is drop you the log when running with
stacktrace
:Run with
java 16 2021-03-16 Java(TM) SE Runtime Environment (build 16+36-2231) Java HotSpot(TM) 64-Bit Server VM (build 16+36-2231, mixed mode, sharing)
I have also provided the token as instructed in the
gradle.properties
under the keygithubAccessToken
. Hope this helps!
I have never encountered this problem. It may be due to running the gradle build using Java 16. Maybe try with Java 15 or below. If this doesn't help try to clear the gradle cache.
It finally did succeed building, but then...
auto-dark-mode on master [✘!] via ☕ v15.0.2 via 🅺
❯ ./gradlew :auto-dark-mode:buildPlugin
./gradlew: 39: cd: can't cd to "./
FAILURE: Build failed with an exception.
* What went wrong:
Project 'auto-dark-mode' is ambiguous in root project 'auto-dark-mode'. Candidates are: 'auto-dark-mode-base', 'auto-dark-mode-dependencies-bom', 'auto-dark-mode-linux', 'auto-dark-mode-linux-gnome', 'auto-dark-mode-macos', 'auto-dark-mode-plugin', 'auto-dark-mode-windows'.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 679ms
I didn't bother with the --stacktrace
because it seems rather obvious, though I checked in the properties
to see if maybe that's where the choice is made, but I didn't see any reference to which project should be built?
It is ./gradlew buildPlugin
only, without the module
On Tue, Apr 6, 2021 at 9:40 AM arudp @.***> wrote:
It finally did succeed building, but then...
auto-dark-mode on master [✘!] via ☕ v15.0.2 via 🅺
❯ ./gradlew :auto-dark-mode:buildPlugin
./gradlew: 39: cd: can't cd to "./
FAILURE: Build failed with an exception.
- What went wrong:
Project 'auto-dark-mode' is ambiguous in root project 'auto-dark-mode'. Candidates are: 'auto-dark-mode-base', 'auto-dark-mode-dependencies-bom', 'auto-dark-mode-linux', 'auto-dark-mode-linux-gnome', 'auto-dark-mode-macos', 'auto-dark-mode-plugin', 'auto-dark-mode-windows'.
- Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
- Get more help at https://help.gradle.org
BUILD FAILED in 679ms
I didn't bother with the --stacktrace because it seems rather obvious, though I checked in the properties to see if maybe that's where the choice is made, but I didn't see any reference to which project should be built?
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/weisJ/auto-dark-mode/issues/32#issuecomment-813901996, or unsubscribe https://github.com/notifications/unsubscribe-auth/AABXXGRC3NLV4W3JE7CUS4LTHK3G7ANCNFSM42I6B4WQ .
Ok, I just tried that and it's still a no :disappointed:
Yeah, had that happening to me. Make sure to do the clean and build first as specified by Janis:
gradlew clean build -PisPublished=false gradlew buildPlugin
Cheers, Javier
On Tue, 6 Apr 2021, 09:56 arudp, @.***> wrote:
Ok, I just tried that and it's still a no 😞
auto-dark-mode on master [✘!] via ☕ v15.0.2 via 🅺
❯ ./gradlew buildPlugin
./gradlew: 39: cd: can't cd to "./
Task :auto-dark-mode-plugin:buildSearchableOptions
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by com.intellij.util.ui.StartupUiUtil to constructor com.sun.java.swing.plaf.gtk.GTKLookAndFeel()
WARNING: Please consider reporting this to the maintainers of com.intellij.util.ui.StartupUiUtil
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
2021-04-06 09:54:24,951 [ 1815] WARN - j.internal.DebugAttachDetector - Unable to start DebugAttachDetector, please add
--add-exports java.base/jdk.internal.vm=ALL-UNNAMED
to VM optionsStarting searchable options index builder
(java:13946): Gtk-WARNING **: 09:54:27.273: Unable to locate theme engine in module_path: "clearlooks",
(java:13946): Gtk-WARNING **: 09:54:27.274: Unable to locate theme engine in module_path: "clearlooks",
Searchable options index builder failed
java.lang.NoClassDefFoundError: com/github/weisj/darkmode/platform/settings/SettingsContainerProvider
at com.github.weisj.darkmode.AutoDarkModeOptions$containers$2.invoke(AutoDarkModeOptions.kt:67) at com.github.weisj.darkmode.AutoDarkModeOptions$containers$2.invoke(AutoDarkModeOptions.kt:40) at kotlin.SynchronizedLazyImpl.getValue(LazyJVM.kt:74) at com.github.weisj.darkmode.AutoDarkModeOptions.getContainers(AutoDarkModeOptions.kt) at com.github.weisj.darkmode.DarkModeConfigurable.createPanel(DarkModeConfigurable.kt:44) at com.intellij.openapi.options.DslConfigurableBase$panel$1.compute(BoundConfigurable.kt:33) at com.intellij.openapi.options.DslConfigurableBase$panel$1.compute(BoundConfigurable.kt:28) at com.intellij.openapi.util.ClearableLazyValue.getValue(ClearableLazyValue.java:39) at com.intellij.openapi.options.DslConfigurableBase.createComponent(BoundConfigurable.kt:41) at com.intellij.openapi.options.ex.ConfigurableWrapper.createComponent(ConfigurableWrapper.java:172) at com.intellij.ide.ui.search.SearchUtil.processConfigurables(SearchUtil.java:81) at com.intellij.ide.ui.search.SearchUtil.processProjectConfigurables(SearchUtil.java:51) at com.intellij.ide.ui.search.TraverseUIStarter.startup(TraverseUIStarter.java:98) at com.intellij.ide.ui.search.TraverseUIStarter.main(TraverseUIStarter.java:81) at com.intellij.idea.ApplicationLoader$startApp$8$1$1.run(ApplicationLoader.kt:245) at com.intellij.openapi.application.TransactionGuardImpl.performUserActivity(TransactionGuardImpl.java:95) at com.intellij.idea.ApplicationLoader$startApp$8$1.run(ApplicationLoader.kt:244) at com.intellij.openapi.application.TransactionGuardImpl.runWithWritingAllowed(TransactionGuardImpl.java:216) at com.intellij.openapi.application.TransactionGuardImpl.access$200(TransactionGuardImpl.java:24) at com.intellij.openapi.application.TransactionGuardImpl$2.run(TransactionGuardImpl.java:199) at com.intellij.openapi.application.impl.ApplicationImpl.runIntendedWriteActionOnCurrentThread(ApplicationImpl.java:822) at com.intellij.openapi.application.impl.ApplicationImpl.lambda$invokeLater$4(ApplicationImpl.java:324) at com.intellij.openapi.application.impl.FlushQueue.doRun(FlushQueue.java:85) at com.intellij.openapi.application.impl.FlushQueue.runNextEvent(FlushQueue.java:134) at com.intellij.openapi.application.impl.FlushQueue.flushNow(FlushQueue.java:47) at com.intellij.openapi.application.impl.FlushQueue$FlushNow.run(FlushQueue.java:190) at java.desktop/java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:313) at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:776) at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:727) at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:721) at java.base/java.security.AccessController.doPrivileged(Native Method) at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:85) at java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:746) at com.intellij.ide.IdeEventQueue.defaultDispatchEvent(IdeEventQueue.java:976) at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.java:843) at com.intellij.ide.IdeEventQueue.lambda$dispatchEvent$8(IdeEventQueue.java:454) at com.intellij.openapi.progress.impl.CoreProgressManager.computePrioritized(CoreProgressManager.java:773) at com.intellij.ide.IdeEventQueue.lambda$dispatchEvent$9(IdeEventQueue.java:453) at com.intellij.openapi.application.impl.ApplicationImpl.runIntendedWriteActionOnCurrentThread(ApplicationImpl.java:822) at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:501) at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:203) at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:124) at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:113) at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:109) at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101) at java.desktop/java.awt.EventDispatchThread.run(EventDispatchThread.java:90)
Caused by: java.lang.ClassNotFoundException: com.github.weisj.darkmode.platform.settings.SettingsContainerProvider PluginClassLoader[PluginDescriptor(name=Auto Dark Mode, id=com.github.weisj.darkmode, path=/home/aru/opt/auto-dark-mode/plugin/build/idea-sandbox/plugins/auto-dark-mode-plugin, version=1.5.3-2020.3)] @.***
at com.intellij.ide.plugins.cl.PluginClassLoader.loadClass(PluginClassLoader.java:129) at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:522) ... 46 more
Task :auto-dark-mode-plugin:buildSearchableOptions FAILED
Build auto-dark-mode FAILURE reason:
Execution failed for task ':auto-dark-mode-plugin:buildSearchableOptions': org.gradle.process.internal.ExecException: Process 'command '/home/aru/.gradle/caches/modules-2/files-2.1/com.jetbrains/jbre/jbr-11_0_9-linux-x64-b1145.21/jbr/bin/java'' finished with non-zero exit value 255 at org.gradle.process.internal.DefaultExecHandle$ExecResultImpl.assertNormalExitValue(DefaultExecHandle.java:417) at org.gradle.process.internal.DefaultJavaExecAction.execute(DefaultJavaExecAction.java:42) at org.gradle.api.tasks.JavaExec.exec(JavaExec.java:158) at org.jetbrains.intellij.tasks.RunIdeBase.exec(RunIdeBase.groovy:203) at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:104) at org.gradle.api.internal.project.taskfactory.StandardTaskAction.doExecute(StandardTaskAction.java:49) at org.gradle.api.internal.project.taskfactory.StandardTaskAction.execute(StandardTaskAction.java:42) at org.gradle.api.internal.project.taskfactory.StandardTaskAction.execute(StandardTaskAction.java:28) at org.gradle.api.internal.AbstractTask$TaskActionWrapper.execute(AbstractTask.java:726) at org.gradle.api.internal.AbstractTask$TaskActionWrapper.execute(AbstractTask.java:693) at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$3.run(ExecuteActionsTaskExecuter.java:569) at org.gradle.internal.operations.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:395) at org.gradle.internal.operations.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:387) at org.gradle.internal.operations.DefaultBuildOperationExecutor$1.execute(DefaultBuildOperationExecutor.java:157) at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:242) at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:150) at org.gradle.internal.operations.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:84) at org.gradle.internal.operations.DelegatingBuildOperationExecutor.run(DelegatingBuildOperationExecutor.java:31) at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.java:554) at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:537) at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.access$300(ExecuteActionsTaskExecuter.java:108) at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$TaskExecution.executeWithPreviousOutputFiles(ExecuteActionsTaskExecuter.java:278) at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$TaskExecution.execute(ExecuteActionsTaskExecuter.java:267) at org.gradle.internal.execution.steps.ExecuteStep.lambda$execute$1(ExecuteStep.java:33) at org.gradle.internal.execution.steps.ExecuteStep.execute(ExecuteStep.java:33) at org.gradle.internal.execution.steps.ExecuteStep.execute(ExecuteStep.java:26) at org.gradle.internal.execution.steps.CleanupOutputsStep.execute(CleanupOutputsStep.java:67) at org.gradle.internal.execution.steps.CleanupOutputsStep.execute(CleanupOutputsStep.java:36) at org.gradle.internal.execution.steps.ResolveInputChangesStep.execute(ResolveInputChangesStep.java:49) at org.gradle.internal.execution.steps.ResolveInputChangesStep.execute(ResolveInputChangesStep.java:34) at org.gradle.internal.execution.steps.CancelExecutionStep.execute(CancelExecutionStep.java:43) at org.gradle.internal.execution.steps.TimeoutStep.executeWithoutTimeout(TimeoutStep.java:73) at org.gradle.internal.execution.steps.TimeoutStep.execute(TimeoutStep.java:54) at org.gradle.internal.execution.steps.CatchExceptionStep.execute(CatchExceptionStep.java:34) at org.gradle.internal.execution.steps.CreateOutputsStep.execute(CreateOutputsStep.java:44) at org.gradle.internal.execution.steps.SnapshotOutputsStep.execute(SnapshotOutputsStep.java:54) at org.gradle.internal.execution.steps.SnapshotOutputsStep.execute(SnapshotOutputsStep.java:38) at org.gradle.internal.execution.steps.BroadcastChangingOutputsStep.execute(BroadcastChangingOutputsStep.java:49) at org.gradle.internal.execution.steps.CacheStep.executeWithoutCache(CacheStep.java:159) at org.gradle.internal.execution.steps.CacheStep.execute(CacheStep.java:72) at org.gradle.internal.execution.steps.CacheStep.execute(CacheStep.java:43) at org.gradle.internal.execution.steps.StoreExecutionStateStep.execute(StoreExecutionStateStep.java:44) at org.gradle.internal.execution.steps.StoreExecutionStateStep.execute(StoreExecutionStateStep.java:33) at org.gradle.internal.execution.steps.RecordOutputsStep.execute(RecordOutputsStep.java:38) at org.gradle.internal.execution.steps.RecordOutputsStep.execute(RecordOutputsStep.java:24) at org.gradle.internal.execution.steps.SkipUpToDateStep.executeBecause(SkipUpToDateStep.java:92) at org.gradle.internal.execution.steps.SkipUpToDateStep.lambda$execute$0(SkipUpToDateStep.java:85) at org.gradle.internal.execution.steps.SkipUpToDateStep.execute(SkipUpToDateStep.java:55) at org.gradle.internal.execution.steps.SkipUpToDateStep.execute(SkipUpToDateStep.java:39) at org.gradle.internal.execution.steps.ResolveChangesStep.execute(ResolveChangesStep.java:76) at org.gradle.internal.execution.steps.ResolveChangesStep.execute(ResolveChangesStep.java:37) at org.gradle.internal.execution.steps.legacy.MarkSnapshottingInputsFinishedStep.execute(MarkSnapshottingInputsFinishedStep.java:36) at org.gradle.internal.execution.steps.legacy.MarkSnapshottingInputsFinishedStep.execute(MarkSnapshottingInputsFinishedStep.java:26) at org.gradle.internal.execution.steps.ResolveCachingStateStep.execute(ResolveCachingStateStep.java:94) at org.gradle.internal.execution.steps.ResolveCachingSta
teStep.execute(ResolveCachingStateStep.java:49)
at org.gradle.internal.execution.steps.CaptureStateBeforeExecutionStep.execute(CaptureStateBeforeExecutionStep.java:79) at org.gradle.internal.execution.steps.CaptureStateBeforeExecutionStep.execute(CaptureStateBeforeExecutionStep.java:53) at org.gradle.internal.execution.steps.ValidateStep.execute(ValidateStep.java:74) at org.gradle.internal.execution.steps.SkipEmptyWorkStep.lambda$execute$2(SkipEmptyWorkStep.java:78) at org.gradle.internal.execution.steps.SkipEmptyWorkStep.execute(SkipEmptyWorkStep.java:78) at org.gradle.internal.execution.steps.SkipEmptyWorkStep.execute(SkipEmptyWorkStep.java:34) at org.gradle.internal.execution.steps.legacy.MarkSnapshottingInputsStartedStep.execute(MarkSnapshottingInputsStartedStep.java:39) at org.gradle.internal.execution.steps.LoadExecutionStateStep.execute(LoadExecutionStateStep.java:40) at org.gradle.internal.execution.steps.LoadExecutionStateStep.execute(LoadExecutionStateStep.java:28)
FAILURE: Build failed with an exception.
- What went wrong:
Execution failed for task ':auto-dark-mode-plugin:buildSearchableOptions'.
Process 'command '/home/aru/.gradle/caches/modules-2/files-2.1/com.jetbrains/jbre/jbr-11_0_9-linux-x64-b1145.21/jbr/bin/java'' finished with non-zero exit value 255
- Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
- Get more help at https://help.gradle.org
BUILD FAILED in 18s
22 actionable tasks: 2 executed, 20 up-to-date
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/weisJ/auto-dark-mode/issues/32#issuecomment-813912504, or unsubscribe https://github.com/notifications/unsubscribe-auth/AABXXGTMHKDBSPUW7WQB6TLTHK5B3ANCNFSM42I6B4WQ .
Alright, done that, it seems it was successful! Now, I'm just going to go ahead and ask before I break anything else... I don't see any obvious installable as a plugin... How do I go about installing it in PyCharm?
The plugin is in plugin/build/distributions/
On Tue, Apr 6, 2021 at 10:21 AM arudp @.***> wrote:
Alright, done that, it seems it was successful! Now, I'm just going to go ahead and ask before I break anything else... I don't see any obvious installable as a plugin... How do I go about installing it in PyCharm?
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/weisJ/auto-dark-mode/issues/32#issuecomment-813929701, or unsubscribe https://github.com/notifications/unsubscribe-auth/AABXXGXZXRM4FR2JXPVHI6DTHLACJANCNFSM42I6B4WQ .
As soon as I applied it, dead PyCharm :disappointed:
How do I go about installing it in PyCharm?
You can run a sandbox instance of idea using the gradlew runIde
task. This ways you don't have to install the plugin manually.
To summarize: The issue can be reliably reproduced and the error happens in https://github.com/weisJ/auto-dark-mode/blob/883f96b3885e329042c6a33b9c538bfbe2449770/linux/gnome/src/main/cpp/DarkModeGnome.cpp#L38
Somehow the settings
reference holds a null
value.
To start I think it would be worth while to create a new settings instance in the method itself i.e.
auto settingsRef = Gio::Settings::create("org.gnome.desktop.interface");
if (!settingsRef) std::cout << "Settings are null!" << std::endl;
auto themeStr = settingsRef->get_string("gtk-theme");
if (!themeStr) std::cout << "Theme string is null!" << std::endl;
return env->NewStringUTF(themeStr.c_str());
I would be very grateful if someone would try this out :)
So this is the patch I have done because the one you did wasn't compiling, however it still segfaults. Would it be possible to maybe generate a branch in this repo to take advantage of the CI to make sure that we can reproduce? Also, I have tried to remove the optimizations so that the stacktrace looks better but still no clue how to do it.
diff --git a/linux/gnome/src/main/cpp/DarkModeGnome.cpp b/linux/gnome/src/main/cpp/DarkModeGnome.cpp
index 153c581..e8ee7ec 100644
--- a/linux/gnome/src/main/cpp/DarkModeGnome.cpp
+++ b/linux/gnome/src/main/cpp/DarkModeGnome.cpp
@@ -26,6 +26,7 @@
#include "GioUtils.hpp"
#include <string>
+#include <iostream>
#include <glibmm-2.4/glibmm.h>
#include <giomm-2.4/giomm.h>
@@ -35,7 +36,13 @@ Glib::RefPtr<Gio::Settings> settings;
JNIEXPORT jstring JNICALL
Java_com_github_weisj_darkmode_platform_linux_gnome_GnomeNative_getCurrentTheme(JNIEnv *env, jclass) {
- return env->NewStringUTF(settings->get_string(THEME_NAME_KEY).c_str());
+ auto settingsRef = Gio::Settings::create("org.gnome.desktop.interface");
+ if (!settingsRef) std::cout << "Settings are null!" << std::endl;
+
+ auto themeStr = settingsRef->get_string("gtk-theme");
+ if (themeStr.empty()) std::cout << "Theme string is null!" << std::endl;
+
+ return env->NewStringUTF(themeStr.c_str());
}
struct EventHandler {
Error:
OpenJDK 64-Bit Server VM warning: Option UseConcMarkSweepGC was deprecated in version 9.0 and will likely be removed in a future release.
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by com.intellij.util.ui.StartupUiUtil to constructor com.sun.java.swing.plaf.gtk.GTKLookAndFeel()
WARNING: Please consider reporting this to the maintainers of com.intellij.util.ui.StartupUiUtil
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
2021-04-06 23:07:45,308 [ 3351] WARN - tellij.ide.SystemHealthMonitor - issue detected: bundled.jre.version.message
#
# A fatal error has been detected by the Java Runtime Environment:
#
# SIGSEGV (0xb) at pc=0x00007fb40ad65d42, pid=439629, tid=439682
#
# JRE version: OpenJDK Runtime Environment (11.0.10+9) (build 11.0.10+9)
# Java VM: OpenJDK 64-Bit Server VM (11.0.10+9, mixed mode, tiered, compressed oops, concurrent mark sweep gc, linux-amd64)
# Problematic frame:
# C [libgiomm-2.4.so.1+0x12ed42] Gio::Settings::signal_changed(Glib::ustring const&)+0x2
#
# Core dump will be written. Default location: Core dumps may be processed with "/usr/lib/systemd/systemd-coredump %P %u %g %s %t %c %h" (or dumping to /home/javier/projects/spinoffs/auto-dark-mode/core.439629)
#
# An error report file with more information is saved as:
# /home/javier/java_error_in_webstorm_439629.log
[thread 439687 also had an error]
#
# If you would like to submit a bug report, please visit:
# https://bugreport.java.com/bugreport/crash.jsp
# The crash happened outside the Java Virtual Machine in native code.
# See problematic frame for where to report the bug.
#
/usr/bin/webstorm: line 229: 439629 Aborted (core dumped) "$JAVA_BIN" -classpath "$CLASSPATH" ${VM_OPTIONS} "-XX:ErrorFile=$HOME/java_error_in_webstorm_%p.log" "-XX:HeapDumpPath=$HOME/java_error_in_webstorm_.hprof" "-Didea.vendor.name=${PRODUCT_VENDOR}" "-Didea.paths.selector=${PATHS_SELECTOR}" "-Djb.vmOptionsFile=$VM_OPTIONS_FILE" ${IDE_PROPERTIES_PROPERTY} -Didea.platform.prefix=WebStorm com.intellij.idea.Main "$@"
Thank you for testing it!
So this is the patch I have done because the one you did wasn't compiling, however it still segfaults.
Though the segfault now happens at another location (i.e. Gio::Settings::signal_changed
) probably for the same reason that the settings
haven't been initialized correctly. Now I'm wondering whether Java_com_github_weisj_darkmode_platform_linux_gnome_GnomeNative_init
actually gets called reliably (maybe the theme is requested before it gets called).
Would it be possible to maybe generate a branch in this repo to take advantage of the CI to make sure that we can reproduce?
I'm not quite sure whether it is possible. The CI action would probably need to install a Gnome desktop environment. Then still the runIde
needs a headful environment, which the action runners don't provide. But at least we could test whether the native code works on its own outside the IDEA environment. It wouldn't be a 100% indicator but a lot better than nothing.
Also, I have tried to remove the optimizations so that the stacktrace looks better but still no clue how to do it.
diff --git a/linux/gnome/src/main/cpp/DarkModeGnome.cpp b/linux/gnome/src/main/cpp/DarkModeGnome.cpp index 153c581..e8ee7ec 100644 --- a/linux/gnome/src/main/cpp/DarkModeGnome.cpp +++ b/linux/gnome/src/main/cpp/DarkModeGnome.cpp @@ -26,6 +26,7 @@ #include "GioUtils.hpp" #include <string> +#include <iostream> #include <glibmm-2.4/glibmm.h> #include <giomm-2.4/giomm.h> @@ -35,7 +36,13 @@ Glib::RefPtr<Gio::Settings> settings; JNIEXPORT jstring JNICALL Java_com_github_weisj_darkmode_platform_linux_gnome_GnomeNative_getCurrentTheme(JNIEnv *env, jclass) { - return env->NewStringUTF(settings->get_string(THEME_NAME_KEY).c_str()); + auto settingsRef = Gio::Settings::create("org.gnome.desktop.interface"); + if (!settingsRef) std::cout << "Settings are null!" << std::endl; + + auto themeStr = settingsRef->get_string("gtk-theme"); + if (themeStr.empty()) std::cout << "Theme string is null!" << std::endl; + + return env->NewStringUTF(themeStr.c_str()); } struct EventHandler {
I'm not quite sure whether it is possible. The CI action would probably need to install a Gnome desktop environment. Then still the runIde needs a headful environment, which the action runners don't provide. But at least we could test whether the native code works on its own outside the IDEA environment. It wouldn't be a 100% indicator but a lot better than nothing.
Just in case I was trying to speak about having a branch that compiles these changes so that you are able to add telemetry / debugging info as you see fit, mainly to ease testing and avoiding broken telephone game situation with code :)
Thanks for the clarification. I have created #34 as a working branch for this issue. Your patch above is already applied. I also added some checks to make sure install
gets called before any information by the settings
is requested.
A new version which includes a fix is uploaded. It should be available in at most 2-3 days.
Well, that's about it. If I try to fire PyCharm the splash will appear and then it vanishes. I actually had to remove the plugin manually because I can't get into PyCharm, of course.
The error log has 1657 lines, will add it if requested.
Otherwise, great work! I really hope I can use this plugin!